from retail
This commit is contained in:
@@ -484,7 +484,9 @@ function Private.GetSubRegionProperties(data, properties)
|
|||||||
if subProperties then
|
if subProperties then
|
||||||
for key, property in pairs(subProperties) do
|
for key, property in pairs(subProperties) do
|
||||||
subIndex[key] = subIndex[key] and subIndex[key] + 1 or 1
|
subIndex[key] = subIndex[key] and subIndex[key] + 1 or 1
|
||||||
property.display = { subIndex[key] .. ". " .. subRegionTypeData.displayName, property.display, property.defaultProperty }
|
property.display = { subRegionTypeData.displayName .. " " .. subIndex[key],
|
||||||
|
property.display,
|
||||||
|
property.defaultProperty }
|
||||||
properties["sub." .. index .. "." .. key ] = property;
|
properties["sub." .. index .. "." .. key ] = property;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Button Widget for our Expand button
|
|||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
if not WeakAuras.IsLibsOK() then return end
|
if not WeakAuras.IsLibsOK() then return end
|
||||||
|
|
||||||
local Type, Version = "WeakAurasExpand", 5
|
local Type, Version = "WeakAurasExpand", 6
|
||||||
|
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
@@ -30,6 +30,12 @@ local function Button_OnClick(frame, button)
|
|||||||
AceGUI:ClearFocus()
|
AceGUI:ClearFocus()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function OnFrameShow(frame)
|
||||||
|
local self = frame.obj
|
||||||
|
local fontObject = self.userdata and self.userdata.option and self.userdata.option.fontObject
|
||||||
|
self:SetFontObject(fontObject or GameFontHighlightLarge)
|
||||||
|
end
|
||||||
|
|
||||||
--[[-----------------------------------------------------------------------------
|
--[[-----------------------------------------------------------------------------
|
||||||
Methods
|
Methods
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
@@ -38,7 +44,6 @@ local methods = {
|
|||||||
self:SetHeight(110)
|
self:SetHeight(110)
|
||||||
self:SetWidth(110)
|
self:SetWidth(110)
|
||||||
self:SetLabel()
|
self:SetLabel()
|
||||||
self:SetFontObject(GameFontHighlightLarge)
|
|
||||||
self:SetImage(nil)
|
self:SetImage(nil)
|
||||||
self:SetImageSize(64, 64)
|
self:SetImageSize(64, 64)
|
||||||
self:SetDisabled(false)
|
self:SetDisabled(false)
|
||||||
@@ -111,6 +116,7 @@ local function Constructor()
|
|||||||
frame:SetScript("OnEnter", Control_OnEnter)
|
frame:SetScript("OnEnter", Control_OnEnter)
|
||||||
frame:SetScript("OnLeave", Control_OnLeave)
|
frame:SetScript("OnLeave", Control_OnLeave)
|
||||||
frame:SetScript("OnClick", Button_OnClick)
|
frame:SetScript("OnClick", Button_OnClick)
|
||||||
|
frame:SetScript("OnShow", OnFrameShow)
|
||||||
|
|
||||||
local image = frame:CreateTexture(nil, "BACKGROUND")
|
local image = frame:CreateTexture(nil, "BACKGROUND")
|
||||||
image:SetWidth(64)
|
image:SetWidth(64)
|
||||||
@@ -119,7 +125,7 @@ local function Constructor()
|
|||||||
|
|
||||||
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightLarge")
|
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightLarge")
|
||||||
label:SetJustifyH("LEFT")
|
label:SetJustifyH("LEFT")
|
||||||
label:SetJustifyV("TOP")
|
label:SetJustifyV("MIDDLE")
|
||||||
label:SetPoint("LEFT", image, "RIGHT", 5, 0)
|
label:SetPoint("LEFT", image, "RIGHT", 5, 0)
|
||||||
label:SetPoint("TOP")
|
label:SetPoint("TOP")
|
||||||
label:SetPoint("BOTTOM")
|
label:SetPoint("BOTTOM")
|
||||||
|
|||||||
@@ -1378,14 +1378,14 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA
|
|||||||
local isFirst = path[#path] == 1;
|
local isFirst = path[#path] == 1;
|
||||||
if (isFirst) then
|
if (isFirst) then
|
||||||
if (needsTriggerName) then
|
if (needsTriggerName) then
|
||||||
optionsName = optionsName .. string.format(L["Trigger %s"], check.trigger);
|
optionsName = optionsName .. OptionsPrivate.GetTriggerTitle(data, check.trigger)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (needsTriggerName) then
|
if (needsTriggerName) then
|
||||||
if (parentType == "AND") then
|
if (parentType == "AND") then
|
||||||
optionsName = optionsName .. string.format(L["and Trigger %s"], check.trigger);
|
optionsName = optionsName .. string.format(L["and %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||||
else
|
else
|
||||||
optionsName = optionsName .. string.format(L["or Trigger %s"], check.trigger);
|
optionsName = optionsName .. string.format(L["or %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1393,9 +1393,9 @@ local function addControlsForIfLine(args, order, data, conditionVariable, totalA
|
|||||||
local isLinked = conditions[i].linked and i > 1
|
local isLinked = conditions[i].linked and i > 1
|
||||||
if (needsTriggerName) then
|
if (needsTriggerName) then
|
||||||
if isLinked then
|
if isLinked then
|
||||||
optionsName = optionsName .. string.format(L["Else If Trigger %s"], check.trigger);
|
optionsName = optionsName .. string.format(L["Else If %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||||
else
|
else
|
||||||
optionsName = optionsName .. string.format(L["If Trigger %s"], check.trigger);
|
optionsName = optionsName .. string.format(L["If %s"], OptionsPrivate.GetTriggerTitle(data, check.trigger));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
optionsName = optionsName .. (isLinked and L["Else If"] or L["If"])
|
optionsName = optionsName .. (isLinked and L["Else If"] or L["If"])
|
||||||
@@ -1954,6 +1954,49 @@ local function fixUpLinkedInFirstCondition(conditions)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function formatConditionTitle(text, propertyType, value)
|
||||||
|
if propertyType == "color" and type(value) == "table" then
|
||||||
|
local r, g, b = unpack(value)
|
||||||
|
r, g, b = r or 1, g or 1, b or 1
|
||||||
|
return ("|cFF%2x%2x%2x%s|r"):format(r * 220 + 35, g * 220 + 35, b * 220 + 35, text)
|
||||||
|
elseif propertyType == "bool" then
|
||||||
|
return ("%s: %s"):format(text, value and L["ON"] or L["OFF"])
|
||||||
|
elseif propertyType == "sound" and type(value) == "table" and type(value.sound) == "string" and value.sound ~= "" then
|
||||||
|
if OptionsPrivate.Private.sound_types[value.sound] then
|
||||||
|
return ("%s: %s"):format(text, OptionsPrivate.Private.sound_types[value.sound])
|
||||||
|
end
|
||||||
|
elseif value ~= nil and type(value) ~= "table" then
|
||||||
|
return ("%s: %s"):format(text, value)
|
||||||
|
end
|
||||||
|
return text
|
||||||
|
end
|
||||||
|
|
||||||
|
local function GetConditionTitle(changes, conditionnum, allProperties)
|
||||||
|
if type(changes) == "table" and #changes > 0 then
|
||||||
|
local outs = {}
|
||||||
|
for i, change in ipairs(changes) do
|
||||||
|
local property = change.property
|
||||||
|
if property and allProperties.propertyMap[property] then
|
||||||
|
local display = allProperties.propertyMap[property].display
|
||||||
|
local propertyType = allProperties.propertyMap[property].type
|
||||||
|
local title
|
||||||
|
if type(display) == "string" then
|
||||||
|
title = display
|
||||||
|
elseif type(display) == "table" then
|
||||||
|
title = ("%s %s"):format(display[1], display[2])
|
||||||
|
end
|
||||||
|
if title then
|
||||||
|
tinsert(outs, formatConditionTitle(title, propertyType, change.value))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #outs > 0 then
|
||||||
|
return L["%i. %s"]:format(conditionnum, table.concat(outs, ", "))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return L["%i."]:format(conditionnum)
|
||||||
|
end
|
||||||
|
|
||||||
local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
|
local function addControlsForCondition(args, order, data, conditionVariable, totalAuraCount, conditions, i, conditionTemplates, conditionTemplateWithoutCombinations, allProperties)
|
||||||
if (not conditions[i].check) then
|
if (not conditions[i].check) then
|
||||||
return order;
|
return order;
|
||||||
@@ -1975,7 +2018,7 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot
|
|||||||
|
|
||||||
args["condition" .. i .. "header"] = {
|
args["condition" .. i .. "header"] = {
|
||||||
type = "execute",
|
type = "execute",
|
||||||
name = L["Condition %i"]:format(i),
|
name = GetConditionTitle(conditions[i].changes, i, allProperties),
|
||||||
order = order,
|
order = order,
|
||||||
width = WeakAuras.doubleWidth - 0.6,
|
width = WeakAuras.doubleWidth - 0.6,
|
||||||
func = function()
|
func = function()
|
||||||
@@ -1993,7 +2036,8 @@ local function addControlsForCondition(args, order, data, conditionVariable, tot
|
|||||||
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
|
image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\collapse" ,
|
||||||
imageWidth = 18,
|
imageWidth = 18,
|
||||||
imageHeight = 18,
|
imageHeight = 18,
|
||||||
control = "WeakAurasExpand"
|
control = "WeakAurasExpand",
|
||||||
|
fontObject = GameFontHighlight
|
||||||
};
|
};
|
||||||
order = order + 1;
|
order = order + 1;
|
||||||
|
|
||||||
@@ -2292,7 +2336,7 @@ local function mergeConditionTemplates(allConditionTemplates, auraConditionsTemp
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function createConditionTemplatesValueList(allConditionTemplates, numTriggers, excludeCombinations)
|
local function createConditionTemplatesValueList(allConditionTemplates, numTriggers, excludeCombinations, data)
|
||||||
local conditionTemplates = {};
|
local conditionTemplates = {};
|
||||||
conditionTemplates.all = allConditionTemplates;
|
conditionTemplates.all = allConditionTemplates;
|
||||||
conditionTemplates.indexToTrigger = {};
|
conditionTemplates.indexToTrigger = {};
|
||||||
@@ -2322,7 +2366,7 @@ local function createConditionTemplatesValueList(allConditionTemplates, numTrigg
|
|||||||
elseif (triggernum == -1) then
|
elseif (triggernum == -1) then
|
||||||
conditionTemplates.display[index] = string.format(L["Global Conditions"]);
|
conditionTemplates.display[index] = string.format(L["Global Conditions"]);
|
||||||
else
|
else
|
||||||
conditionTemplates.display[index] = string.format(L["Trigger %d"], triggernum);
|
conditionTemplates.display[index] = OptionsPrivate.GetTriggerTitle(data, triggernum)
|
||||||
end
|
end
|
||||||
index = index + 1;
|
index = index + 1;
|
||||||
|
|
||||||
@@ -2381,7 +2425,7 @@ local function createConditionTemplates(data)
|
|||||||
}
|
}
|
||||||
allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions();
|
allConditionTemplates[-1] = OptionsPrivate.Private.GetGlobalConditions();
|
||||||
|
|
||||||
local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers);
|
local conditionTemplates = createConditionTemplatesValueList(allConditionTemplates, numTriggers, nil, data);
|
||||||
|
|
||||||
if (data.controlledChildren) then
|
if (data.controlledChildren) then
|
||||||
conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display);
|
conditionTemplates.displayWithCopy = CopyTable(conditionTemplates.display);
|
||||||
@@ -2391,7 +2435,7 @@ local function createConditionTemplates(data)
|
|||||||
conditionTemplates.indexToVariable[9998] = "COPY";
|
conditionTemplates.indexToVariable[9998] = "COPY";
|
||||||
end
|
end
|
||||||
|
|
||||||
local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true);
|
local conditionTemplateWithoutCombinations = createConditionTemplatesValueList(allConditionTemplates, numTriggers, true, data);
|
||||||
|
|
||||||
return conditionTemplates, conditionTemplateWithoutCombinations;
|
return conditionTemplates, conditionTemplateWithoutCombinations;
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -253,10 +253,30 @@ function OptionsPrivate.ClearTriggerExpandState()
|
|||||||
maxTriggerNumForExpand = 0
|
maxTriggerNumForExpand = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function OptionsPrivate.GetTriggerTitle(data, triggernum)
|
||||||
|
if data.triggers[triggernum] then
|
||||||
|
local trigger = data.triggers[triggernum].trigger
|
||||||
|
if trigger then
|
||||||
|
local event_prototype = OptionsPrivate.Private.event_prototypes[trigger.event]
|
||||||
|
local triggerType = trigger.type
|
||||||
|
local name
|
||||||
|
if triggerType == "aura2" then
|
||||||
|
name = L["Aura"]
|
||||||
|
elseif triggerType == "custom" then
|
||||||
|
name = L["Custom"]
|
||||||
|
else
|
||||||
|
name = event_prototype.name
|
||||||
|
end
|
||||||
|
return L["Trigger %i: %s"]:format(triggernum, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return L["Trigger %i"]:format(triggernum)
|
||||||
|
end
|
||||||
|
|
||||||
local triggerDeleteDialogOpen = false
|
local triggerDeleteDialogOpen = false
|
||||||
|
|
||||||
function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
|
function OptionsPrivate.AddTriggerMetaFunctions(options, data, triggernum)
|
||||||
options.__title = L["Trigger %s"]:format(triggernum)
|
options.__title = OptionsPrivate.GetTriggerTitle(data, triggernum)
|
||||||
options.__order = triggernum * 10
|
options.__order = triggernum * 10
|
||||||
options.__collapsed = #data.triggers > 1
|
options.__collapsed = #data.triggers > 1
|
||||||
options.__isCollapsed = function()
|
options.__isCollapsed = function()
|
||||||
|
|||||||
Reference in New Issue
Block a user