Update general layout of WeakAurasOptions (#8)

* from retail

* (fix) improve pixel snapping by reapplying borders

* update spinbox texture

* add icons, loaded, standby, unloaded behavior from retail

* further use of ported inputbox and cleanup to ported frames

* move templates into WeakAuras and upversion
This commit is contained in:
NoM0Re
2025-01-04 19:33:14 +01:00
committed by GitHub
parent a62d8f352e
commit 86e98d6bcf
47 changed files with 1582 additions and 679 deletions
+1 -1
View File
@@ -322,7 +322,7 @@ function Private.Animate(namespace, uid, type, anim, region, inverse, onFinished
if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then
local data = Private.GetDataByUID(uid); local data = Private.GetDataByUID(uid);
if(data and data.parent) then if(data and data.parent) then
local parentRegion = WeakAuras.regions[data.parent].region; local parentRegion = WeakAuras.GetRegion(data.parent)
if(parentRegion and parentRegion.controlledRegions) then if(parentRegion and parentRegion.controlledRegions) then
for index, regionData in pairs(parentRegion.controlledRegions) do for index, regionData in pairs(parentRegion.controlledRegions) do
local childRegion = regionData.region; local childRegion = regionData.region;
+2 -2
View File
@@ -192,8 +192,8 @@ function Private.ActivateAuraEnvironmentForRegion(region, onlyConfig)
end end
function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig) function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
local data = WeakAuras.GetData(id) local data = id and WeakAuras.GetData(id)
local region = WeakAuras.GetRegion(id, cloneId) local region = id and Private.EnsureRegion(id, cloneId)
if not data then if not data then
-- Pop the last aura_env from the stack, and update current_aura_env appropriately. -- Pop the last aura_env from the stack, and update current_aura_env appropriately.
tremove(aura_env_stack) tremove(aura_env_stack)
+53 -5
View File
@@ -50,10 +50,10 @@ local severityLevel = {
} }
local icons = { local icons = {
info = [[Interface/friendsframe/informationicon.blp]], info = { path = [[Interface\friendsframe\informationicon]] },
sound = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\voicechat", sound = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\ChatFrame", texCoords = {0.757812, 0.871094, 0.0078125, 0.234375} },
warning = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\alert", warning = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\ServicesAtlas", texCoords = {0.000976562, 0.0419922, 0.961914, 0.998047} },
error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]] error = { path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\HelpIcon-Bug" },
} }
local titles = { local titles = {
@@ -72,7 +72,13 @@ local function AddMessages(result, messages, icon, mixedSeverity)
result = result .. "\n\n" result = result .. "\n\n"
end end
if mixedSeverity then if mixedSeverity then
result = result .. "|T" .. icon .. ":12:12:0:0:64:64:4:60:4:60|t" local iconPath = icon.path
local texCoords = icon.texCoords
if texCoords then
result = result .. string.format("|T%s:12:12:0:0:64:64:%d:%d:%d:%d|t", iconPath, texCoords[1] * 64, texCoords[2] * 64, texCoords[3] * 64, texCoords[4] * 64)
else
result = result .. string.format("|T%s:12:12:0:0:64:64:4:60:4:60|t", iconPath)
end
end end
result = result .. message result = result .. message
end end
@@ -113,6 +119,48 @@ local function FormatWarnings(uid)
return icons[maxSeverity], titles[maxSeverity], result return icons[maxSeverity], titles[maxSeverity], result
end end
local function GetAllWarnings(uid)
local results = {}
local thisWarnings
local data = Private.GetDataByUID(uid)
if data.regionType == "group" or data.regionType == "dynamicgroup" then
thisWarnings = {}
for child in Private.TraverseLeafs(data) do
local childWarnings = warnings[child.uid]
if childWarnings then
for key, warning in pairs(childWarnings) do
if not thisWarnings[key] then
thisWarnings[key] = {
severity = warning.severity,
message = warning.message,
auraId = child.id
}
end
end
end
end
else
thisWarnings = CopyTable(warnings[uid])
local auraId = Private.UIDtoID(uid)
for key in pairs(thisWarnings) do
thisWarnings[key].auraId = auraId
end
end
-- Order them by severity, keeping just one per severity
for key, warning in pairs(thisWarnings) do
results[warning.severity] = {
icon = icons[warning.severity],
prio = 5 + severityLevel[warning.severity],
title = titles[warning.severity] or warning.severity,
message = warning.message,
auraId = warning.auraId,
key = key
}
end
return results
end
Private.AuraWarnings = {} Private.AuraWarnings = {}
Private.AuraWarnings.UpdateWarning = UpdateWarning Private.AuraWarnings.UpdateWarning = UpdateWarning
Private.AuraWarnings.FormatWarnings = FormatWarnings Private.AuraWarnings.FormatWarnings = FormatWarnings
Private.AuraWarnings.GetAllWarnings = GetAllWarnings
+43 -2
View File
@@ -100,7 +100,7 @@ end
function WeakAuras.split(input) function WeakAuras.split(input)
input = input or ""; input = input or "";
local ret = {}; local ret = {};
local split, element = true; local split, element = nil, nil;
split = input:find("[,%s]"); split = input:find("[,%s]");
while(split) do while(split) do
element, input = input:sub(1, split-1), input:sub(split+1); element, input = input:sub(1, split-1), input:sub(split+1);
@@ -115,6 +115,36 @@ function WeakAuras.split(input)
return ret; return ret;
end end
local function findFirstOf(input, words, start, plain)
local startPos, endPos
for _, w in ipairs(words) do
local s, e = input:find(w, start, plain)
if s and (not startPos or startPos > s) then
startPos, endPos = s, e
end
end
return startPos, endPos
end
function Private.splitAtOr(input)
input = input or ""
local ret = {}
local splitStart, splitEnd, element = nil, nil, nil
local separators = { "|", " or "}
splitStart, splitEnd = findFirstOf(input, separators, 1, true);
while(splitStart) do
element, input = input:sub(1, splitStart -1 ), input:sub(splitEnd + 1)
if(element ~= "") then
tinsert(ret, element)
end
splitStart, splitEnd = findFirstOf(input, separators, 1, true);
end
if(input ~= "") then
tinsert(ret, input)
end
return ret;
end
function TestForTriState(trigger, arg) function TestForTriState(trigger, arg)
local name = arg.name; local name = arg.name;
local test; local test;
@@ -1315,6 +1345,8 @@ function GenericTrigger.Add(data, region)
events[id] = nil; events[id] = nil;
watched_trigger_events[id] = nil watched_trigger_events[id] = nil
local warnAboutCLEUEvents = false
for triggernum, triggerData in ipairs(data.triggers) do for triggernum, triggerData in ipairs(data.triggers) do
local trigger, untrigger = triggerData.trigger, triggerData.untrigger local trigger, untrigger = triggerData.trigger, triggerData.untrigger
local triggerType; local triggerType;
@@ -1474,6 +1506,9 @@ function GenericTrigger.Add(data, region)
local isCLEU = false local isCLEU = false
local isUnitEvent = false local isUnitEvent = false
local isTrigger = false local isTrigger = false
if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then
warnAboutCLEUEvents = true
end
for i in event:gmatch("[^:]+") do for i in event:gmatch("[^:]+") do
if not trueEvent then if not trueEvent then
trueEvent = string.upper(i) trueEvent = string.upper(i)
@@ -1574,7 +1609,13 @@ function GenericTrigger.Add(data, region)
end end
end end
if warnAboutCLEUEvents then
Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning", "warning",
L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment. Find more information:\nhttps://github.com/WeakAuras/WeakAuras2/wiki/Deprecated-CLEU"],
true)
else
Private.AuraWarnings.UpdateWarning(data.uid, "spamy_event_warning")
end
end end
do do
+1 -1
View File
@@ -8,7 +8,7 @@ WeakAuras.halfWidth = WeakAuras.normalWidth / 2
WeakAuras.doubleWidth = WeakAuras.normalWidth * 2 WeakAuras.doubleWidth = WeakAuras.normalWidth * 2
local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version") local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version")
local versionString = "4.1.1" local versionString = "4.1.2"
local buildTime = "20240701180000" local buildTime = "20240701180000"
local isAwesomeEnabled = C_NamePlate and C_NamePlate.GetNamePlateForUnit or false local isAwesomeEnabled = C_NamePlate and C_NamePlate.GetNamePlateForUnit or false
@@ -213,7 +213,7 @@ local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide() frame:Hide()
local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate") local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "WA_InputBoxTemplate")
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal) editbox:SetFontObject(ChatFontNormal)
editbox:SetScript("OnEnter", Control_OnEnter) editbox:SetScript("OnEnter", Control_OnEnter)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7
View File
@@ -994,6 +994,7 @@ Private.load_prototype = {
init = "arg", init = "arg",
values = "group_types", values = "group_types",
events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"}, events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"},
optional = true,
}, },
{ {
name = "group_leader", name = "group_leader",
@@ -1003,6 +1004,7 @@ Private.load_prototype = {
events = {"PARTY_LEADER_CHANGED", "RAID_ROSTER_UPDATE"}, events = {"PARTY_LEADER_CHANGED", "RAID_ROSTER_UPDATE"},
values = "group_member_types", values = "group_member_types",
test = "WeakAuras.CheckGroupMemberType(%s, group_leader)", test = "WeakAuras.CheckGroupMemberType(%s, group_leader)",
optional = true,
}, },
{ {
name ="locationTitle", name ="locationTitle",
@@ -1021,6 +1023,7 @@ Private.load_prototype = {
desc = function() desc = function()
return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), L["Supports multiple entries, separated by commas"]) return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), L["Supports multiple entries, separated by commas"])
end, end,
optional = true,
}, },
{ {
name = "zoneId", name = "zoneId",
@@ -1033,6 +1036,7 @@ Private.load_prototype = {
desc = function() desc = function()
return ("\n|cffffd200%s|r%s: %d\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), GetCurrentMapAreaID(), L["Supports multiple entries, separated by commas"]) return ("\n|cffffd200%s|r%s: %d\n\n%s"):format(L["Current Zone\n"], GetRealZoneText(), GetCurrentMapAreaID(), L["Supports multiple entries, separated by commas"])
end, end,
optional = true,
}, },
{ {
name = "subzone", name = "subzone",
@@ -1046,6 +1050,7 @@ Private.load_prototype = {
desc = function() desc = function()
return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetMinimapZoneText(), L["Supports multiple entries, separated by commas"]) return ("\n|cffffd200%s|r%s\n\n%s"):format(L["Current Zone\n"], GetMinimapZoneText(), L["Supports multiple entries, separated by commas"])
end, end,
optional = true,
}, },
{ {
name = "size", name = "size",
@@ -1055,6 +1060,7 @@ Private.load_prototype = {
sorted = true, sorted = true,
init = "arg", init = "arg",
events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" },
optional = true,
}, },
{ {
name = "difficulty", name = "difficulty",
@@ -1064,6 +1070,7 @@ Private.load_prototype = {
sorted = true, sorted = true,
init = "arg", init = "arg",
events = {"PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, events = {"PLAYER_DIFFICULTY_CHANGED", "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "WA_DELAYED_PLAYER_ENTERING_WORLD" },
optional = true,
}, },
{ {
name ="equipmentTitle", name ="equipmentTitle",
+4
View File
@@ -837,6 +837,10 @@ local function modify(parent, region, data)
if self.suspended > 0 then if self.suspended > 0 then
self.suspended = self.suspended - 1 self.suspended = self.suspended - 1
end end
region:RunDelayedActions()
end
function region:RunDelayedActions()
if not self:IsSuspended() then if not self:IsSuspended() then
if self.needToReload then if self.needToReload then
self:ReloadControlledChildren() self:ReloadControlledChildren()
+5 -2
View File
@@ -140,8 +140,11 @@ local function modify(parent, region, data)
if(region.height ~= height) then if(region.height ~= height) then
region.height = height region.height = height
region:SetHeight(height) region:SetHeight(height)
if(data.parent and WeakAuras.regions[data.parent].region.PositionChildren) then if data.parent then
WeakAuras.regions[data.parent].region:PositionChildren(); Private.EnsureRegion(data.parent)
if WeakAuras.regions[data.parent].region.PositionChildren then
WeakAuras.regions[data.parent].region:PositionChildren()
end
end end
end end
end end
+129
View File
@@ -0,0 +1,129 @@
function WA_MaximizeMinimizeButtonFrame_Mixin(frame)
if frame and frame.init then return end
frame.init = true
frame.isMinimized = false
frame.maximizedCallback = nil
frame.minimizedCallback = nil
local methods = {
OnShow = function(self)
if self.isMinimized then
self:SetMaximizedLook()
else
self:SetMinimizedLook()
end
end,
IsMinimized = function(self)
return self.isMinimized
end,
SetOnMaximizedCallback = function(self, callback)
self.maximizedCallback = callback
end,
SetOnMinimizedCallback = function(self, callback)
self.minimizedCallback = callback
end,
Maximize = function(self, skipCallback)
if self.maximizedCallback and not skipCallback then
self:maximizedCallback()
end
self.isMinimized = false
self:SetMinimizedLook()
end,
Minimize = function(self, skipCallback)
if self.minimizedCallback and not skipCallback then
self:minimizedCallback()
end
self.isMinimized = true
self:SetMaximizedLook()
end,
SetMinimizedLook = function(self)
self.MaximizeButton:Hide()
self.MinimizeButton:Show()
end,
SetMaximizedLook = function(self)
self.MaximizeButton:Show()
self.MinimizeButton:Hide()
end,
}
for name, func in pairs(methods) do
frame[name] = func
end
end
function WA_PortraitFrameTemplate_Mixin(frame)
if frame and frame.init then return end
frame.init = true
frame.Bg:SetVertexColor(0.5882, 0.6275, 0.6706, 0.8) -- approx. PANEL_BACKGROUND_COLOR #ff1f1e21
frame.layoutType = "PortraitMode"
local methods = {
ShowPortrait = function(self)
self.PortraitContainer:Show();
self.NineSlice.TopLeftCorner:Show();
self.NineSlice.TopLeftCornerNoPortrait:Hide();
self.layoutType = "PortraitMode"
end,
HidePortrait = function(self)
self.PortraitContainer:Hide();
self.NineSlice.TopLeftCorner:Hide();
self.NineSlice.TopLeftCornerNoPortrait:Show();
self.layoutType = "NoPortraitMode"
end,
GetFrameLayoutType = function(self)
return self.layoutType or self:GetParent().layoutType;
end
}
for name, func in pairs(methods) do
frame[name] = func
end
end
local function setCorner(corner, point, relativeTo, x, y, width, height)
corner:ClearAllPoints()
corner:SetPoint(point, relativeTo, x, y)
corner:SetSize(width, height)
end
local function setEdge(edge, point1, relativeTo1, point2, relativeTo2, width, height)
edge:ClearAllPoints()
edge:SetSize(width, height)
edge:SetPoint(point1, relativeTo1, point2, 0, 0)
edge:SetPoint(point2, relativeTo2, point1, 0, 0)
end
function WA_UpdateNineSliceBorders(frame)
local NineSlice = frame.NineSlice
if not NineSlice then return end
local PortaitMode = frame:GetFrameLayoutType() == "PortraitMode"
local topLeftCorner = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
local topEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
local leftEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
-- Top Left Corner
setCorner(topLeftCorner, "TOPLEFT", NineSlice, -13, 16, 75, 75)
-- Top Right Corner
setCorner(NineSlice.TopRightCorner, "TOPRIGHT", NineSlice, 4, 16, 75, 75)
-- Bottom Left Corner
setCorner(NineSlice.BottomLeftCorner, "BOTTOMLEFT", NineSlice, -13, -3, 32, 32)
-- Bottom Right Corner
setCorner(NineSlice.BottomRightCorner, "BOTTOMRIGHT", NineSlice, 4, -3, 32, 32)
-- Top Edge
setEdge(NineSlice.TopEdge, "TOPLEFT", topEdgeRelativeTo, "TOPRIGHT", NineSlice.TopRightCorner, 32, 75)
-- Bottom Edge
setEdge(NineSlice.BottomEdge, "BOTTOMLEFT", NineSlice.BottomLeftCorner, "BOTTOMRIGHT", NineSlice.BottomRightCorner, 32, 32)
-- Left Edge
setEdge(NineSlice.LeftEdge, "TOPLEFT", leftEdgeRelativeTo, "BOTTOMLEFT", NineSlice.BottomLeftCorner, 75, 8)
-- Right Edge
setEdge(NineSlice.RightEdge, "TOPLEFT", NineSlice.TopRightCorner, "BOTTOMLEFT", NineSlice.BottomRightCorner, 75, 8)
end
+342
View File
@@ -0,0 +1,342 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<!--
*******************************************************************************
PortraitFrameTemplate (Retail 11.0.5 (57171))
This is an empty frame with space for a portrait/icon in the top left corner.
*******************************************************************************
-->
<Frame name="WA_PortraitFrameTemplate" virtual="true" frameLevel="1">
<Size x="338" y="424"/>
<Frames>
<!-- NineSlice Borders -->
<Frame name="$parentNineSlice" parentKey="NineSlice" setAllPoints="true" frameLevel="3">
<Layers>
<Layer level="OVERLAY">
<!-- Top Left Corner -->
<Texture name="$parentTopLeftCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopLeftCorner">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-13" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0.298828" bottom="0.591797"/>
</Texture>
<Texture name="$parentTopLeftCornerNoPortrait" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopLeftCornerNoPortrait" hidden="true">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-8" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0.00195312" bottom="0.294922"/>
</Texture>
<!-- Top Right Corner -->
<Texture name="$parentTopRightCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopRightCorner">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="4" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.591797" top="0.00195312" bottom="0.294922"/>
</Texture>
<!-- Bottom Left Corner -->
<Texture name="$parentBottomLeftCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="BottomLeftCorner">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="-13" y="-3"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.423828" top="0.298828" bottom="0.423828"/>
</Texture>
<!-- Bottom Right Corner -->
<Texture name="$parentBottomRightCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="BottomRightCorner">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="4" y="-3"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.427734" right="0.552734" top="0.298828" bottom="0.423828"/>
</Texture>
<!-- Top Edge -->
<Texture name="$parentTopEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalHorizontal2x" parentKey="TopEdge" horizTile="true">
<Size x="32" y="75"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeftCorner" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parentTopRightCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00000000" right="1.00000000" top="0.00390625" bottom="0.589844"/>
</Texture>
<!-- Bottom Edge -->
<Texture name="$parentBottomEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalHorizontal2x" parentKey="BottomEdge" horizTile="true">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeftCorner" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRightCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00000000" right="0.50000000" top="0.597656" bottom="0.847656"/>
</Texture>
<!-- Left Edge -->
<Texture name="$parentLeftEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalVertical2x" parentKey="LeftEdge" vertTile="true">
<Size x="75" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeftCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeftCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0" bottom="1"/>
</Texture>
<!-- Right Edge -->
<Texture name="$parentRightEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalVertical2x" parentKey="RightEdge" vertTile="true">
<Size x="75" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopRightCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomRightCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.591797" top="0" bottom="1"/>
</Texture>
</Layer>
</Layers>
</Frame>
<!-- Portrait Container -->
<Frame parentKey="PortraitContainer" frameLevel="3">
<Size x="1" y="1"/>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<!-- Portrait -->
<Texture name="$parentPortrait" parentKey="portrait">
<Size x="62" y="62"/>
<Anchors>
<Anchor point="TOPLEFT" x="-5" y="7"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
<!-- Title Container -->
<Frame parentKey="TitleContainer" frameLevel="4">
<Size x="0" y="20"/>
<Anchors>
<Anchor point="TOPLEFT" x="58" y="-1"/>
<Anchor point="TOPRIGHT" x="-24" y="-1"/>
</Anchors>
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentTitleText" inherits="GameFontNormal" text="" parentKey="TitleText" wordwrap="false">
<Anchors>
<Anchor point="TOP" x="0" y="-5"/>
<Anchor point="LEFT"/>
<Anchor point="RIGHT"/>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<!-- Close Button -->
<Button parentKey="CloseButton" inherits="UIPanelCloseButton" frameLevel="4">
<Size x="24" y="24"/>
<Anchors>
<Anchor point="TOPRIGHT" x="0" y="0"/>
</Anchors>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
</Frames>
<Layers>
<Layer level="BACKGROUND">
<Texture parentKey="Bg" file="Interface\AddOns\WeakAuras\Media\Textures\UI-Background-Rock" horizTile="true" vertTile="true">
<Anchors>
<Anchor point="TOPLEFT" x="2" y="-21"/>
<Anchor point="BOTTOMRIGHT" x="-2" y="2"/>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture parentKey="TopTileStreaks" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameHorizontal" horizTile="true">
<Size x="256" y="43"/>
<Anchors>
<Anchor point="TOPLEFT" x="6" y="-21"/>
<Anchor point="TOPRIGHT" x="-2" y="-21"/>
</Anchors>
<TexCoords left="0.00000000" right="1.00000000" top="0.0078125" bottom="0.34375"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
WA_PortraitFrameTemplate_Mixin(self);
</OnLoad>
<OnSizeChanged>
WA_UpdateNineSliceBorders(self);
</OnSizeChanged>
</Scripts>
</Frame>
<!--
*******************************************************************************
MaximizeMinimizeButtonFrameTemplate (Retail 11.0.5 (57171))
Maximize and Minimize Button with mixedin Callbacks.
*******************************************************************************
-->
<Frame name="WA_MaximizeMinimizeButtonFrameTemplate" virtual="true" frameLevel="4">
<Size x="24" y="24"/>
<Frames>
<Button name="MaximizeButton" parentKey="MaximizeButton" setAllPoints="true" hidden="true">
<Scripts>
<OnClick>
self:GetParent():Maximize();
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
<Button name="$parentMinimizeButton" parentKey="MinimizeButton" setAllPoints="true">
<Scripts>
<OnClick>
self:GetParent():Minimize();
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
</Frames>
<Scripts>
<OnLoad>
WA_MaximizeMinimizeButtonFrame_Mixin(self);
</OnLoad>
<OnShow>
self:OnShow();
</OnShow>
</Scripts>
</Frame>
<!--
*******************************************************************************
InputBoxTemplate (Retail 11.0.5 (57171))
*******************************************************************************
-->
<EditBox name="WA_InputBoxTemplate" enableMouse="true" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" parentKey="Left" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="8" y="20"/>
<Anchors>
<Anchor point="LEFT" x="-5" y="0"/>
</Anchors>
<TexCoords left="0.886719" right="0.949219" top="0.335938" bottom="0.648438"/>
</Texture>
<Texture name="$parentRight" parentKey="Right" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="8" y="20"/>
<Anchors>
<Anchor point="RIGHT" x="0" y="0"/>
</Anchors>
<TexCoords left="0.00390625" right="0.0664062" top="0.664062" bottom="0.976562"/>
</Texture>
<Texture name="$parentMiddle" parentKey="Middle" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="10" y="20"/>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.00390625" right="0.878906" top="0.335938" bottom="0.648438"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEscapePressed>
EditBox_ClearFocus(self);
</OnEscapePressed>
<OnEditFocusLost>
EditBox_ClearHighlight(self);
</OnEditFocusLost>
<OnEditFocusGained>
EditBox_HighlightText(self);
</OnEditFocusGained>
</Scripts>
<FontString inherits="ChatFontNormal"/>
</EditBox>
</Ui>
+196 -78
View File
@@ -181,7 +181,6 @@ local loadEvents = {}
-- All regions keyed on id, has properties: region, regionType, also see clones -- All regions keyed on id, has properties: region, regionType, also see clones
WeakAuras.regions = {}; WeakAuras.regions = {};
local regions = WeakAuras.regions;
-- keyed on id, contains bool indicating whether the aura is loaded -- keyed on id, contains bool indicating whether the aura is loaded
Private.loaded = {}; Private.loaded = {};
@@ -1073,7 +1072,12 @@ function Private.Login(initialTime, takeNewSnapshots)
end end
loginFinished = true loginFinished = true
Private.ResumeAllDynamicGroups(); -- Tell Dynamic Groups that we are done with login
for _, region in pairs(WeakAuras.regions) do
if (region.region.RunDelayedActions) then
region.region:RunDelayedActions();
end
end
end) end)
if initialTime then if initialTime then
@@ -1098,10 +1102,10 @@ function Private.Login(initialTime, takeNewSnapshots)
end end
end end
local frame = CreateFrame("FRAME", "WeakAurasFrame", UIParent); local WeakAurasFrame = CreateFrame("FRAME", "WeakAurasFrame", UIParent);
WeakAuras.frames["WeakAuras Main Frame"] = frame; WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame;
frame:SetAllPoints(UIParent); WeakAurasFrame:SetAllPoints(UIParent);
frame:SetFrameStrata("BACKGROUND"); WeakAurasFrame:SetFrameStrata("BACKGROUND");
local loadedFrame = CreateFrame("FRAME"); local loadedFrame = CreateFrame("FRAME");
WeakAuras.frames["Addon Initialization Handler"] = loadedFrame; WeakAuras.frames["Addon Initialization Handler"] = loadedFrame;
@@ -1230,17 +1234,21 @@ function Private.SquelchingActions()
end end
function Private.PauseAllDynamicGroups() function Private.PauseAllDynamicGroups()
for id, region in pairs(regions) do local suspended = {}
for id, region in pairs(WeakAuras.regions) do
if (region.region.Suspend) then if (region.region.Suspend) then
region.region:Suspend(); region.region:Suspend();
tinsert(suspended, id)
end end
end end
return suspended
end end
function Private.ResumeAllDynamicGroups() function Private.ResumeAllDynamicGroups(suspended)
for id, region in pairs(regions) do for _, id in ipairs(suspended) do
if (region.region.Resume) then local region = WeakAuras.GetRegion(id)
region.region:Resume(); if (region and region.Resume) then
region:Resume();
end end
end end
end end
@@ -1369,6 +1377,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
if(shouldBeLoaded and not loaded[id]) then if(shouldBeLoaded and not loaded[id]) then
changed = changed + 1; changed = changed + 1;
toLoad[id] = true; toLoad[id] = true;
Private.EnsureRegion(id)
for parent in Private.TraverseParents(data) do for parent in Private.TraverseParents(data) do
parentsToCheck[parent.id] = true parentsToCheck[parent.id] = true
end end
@@ -1418,8 +1427,12 @@ function Private.ScanForLoadsGroup(toCheck)
any_loaded = nil any_loaded = nil
end end
end end
if any_loaded then
Private.EnsureRegion(id)
end
loaded[id] = any_loaded; loaded[id] = any_loaded;
else else
Private.EnsureRegion(id)
loaded[id] = true; loaded[id] = true;
end end
end end
@@ -1488,7 +1501,9 @@ end
local function UnloadAll() local function UnloadAll()
-- Even though auras are collapsed, their finish animation can be running -- Even though auras are collapsed, their finish animation can be running
for id in pairs(loaded) do for id in pairs(loaded) do
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) if WeakAuras.regions[id] and WeakAuras.regions[id].region then
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true)
end
if clones[id] then if clones[id] then
for cloneId, region in pairs(clones[id]) do for cloneId, region in pairs(clones[id]) do
Private.CancelAnimation(region, true, true, true, true, true, true) Private.CancelAnimation(region, true, true, true, true, true, true)
@@ -1526,9 +1541,9 @@ end
function Private.Resume() function Private.Resume()
paused = false; paused = false;
Private.PauseAllDynamicGroups(); local suspended = Private.PauseAllDynamicGroups()
for id, region in pairs(regions) do for id, region in pairs(WeakAuras.regions) do
region.region:Collapse(); region.region:Collapse();
end end
@@ -1545,7 +1560,7 @@ function Private.Resume()
Private.ScanForLoadsGroup(loadEvents["GROUP"]) Private.ScanForLoadsGroup(loadEvents["GROUP"])
end end
Private.ResumeAllDynamicGroups(); Private.ResumeAllDynamicGroups(suspended)
end end
function Private.LoadDisplays(toLoad, ...) function Private.LoadDisplays(toLoad, ...)
@@ -1661,30 +1676,27 @@ function WeakAuras.Delete(data)
end end
end end
regions[id].region:Collapse() if WeakAuras.regions[id] then
Private.CollapseAllClones(id); WeakAuras.regions[id].region:Collapse()
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true)
Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) WeakAuras.regions[id].region = nil
WeakAuras.regions[id] = nil
end
if clones[id] then if clones[id] then
for cloneId, region in pairs(clones[id]) do for cloneId, region in pairs(clones[id]) do
Private.CancelAnimation(region, true, true, true, true, true, true) region:Collapse();
Private.CancelAnimation(region, true, true, true, true, true, true)
end end
clones[id] = nil
end end
regions[id].region:SetScript("OnUpdate", nil);
regions[id].region:SetScript("OnShow", nil);
regions[id].region:SetScript("OnHide", nil);
regions[id].region:Hide();
db.registered[id] = nil; db.registered[id] = nil;
for _, triggerSystem in pairs(triggerSystems) do for _, triggerSystem in pairs(triggerSystems) do
triggerSystem.Delete(id); triggerSystem.Delete(id);
end end
regions[id].region = nil;
regions[id] = nil;
loaded[id] = nil; loaded[id] = nil;
loadFuncs[id] = nil; loadFuncs[id] = nil;
loadFuncsForOptions[id] = nil; loadFuncsForOptions[id] = nil;
@@ -1739,9 +1751,18 @@ function WeakAuras.Rename(data, newid)
end end
UIDtoID[data.uid] = newid UIDtoID[data.uid] = newid
regions[newid] = regions[oldid]; WeakAuras.regions[newid] = WeakAuras.regions[oldid];
regions[oldid] = nil; WeakAuras.regions[oldid] = nil;
regions[newid].region.id = newid; if WeakAuras.regions[newid] then
WeakAuras.regions[newid].region.id = newid
end
if(clones[oldid]) then
clones[newid] = clones[oldid]
clones[oldid] = nil
for cloneid, clone in pairs(clones[newid]) do
clone.id = newid
end
end
for _, triggerSystem in pairs(triggerSystems) do for _, triggerSystem in pairs(triggerSystems) do
triggerSystem.Rename(oldid, newid); triggerSystem.Rename(oldid, newid);
@@ -1771,14 +1792,6 @@ function WeakAuras.Rename(data, newid)
db.displays[newid] = db.displays[oldid]; db.displays[newid] = db.displays[oldid];
db.displays[oldid] = nil; db.displays[oldid] = nil;
if(clones[oldid]) then
clones[newid] = clones[oldid];
clones[oldid] = nil;
for cloneid, clone in pairs(clones[newid]) do
clone.id = newid;
end
end
db.displays[newid].id = newid; db.displays[newid].id = newid;
if(data.controlledChildren) then if(data.controlledChildren) then
@@ -1788,9 +1801,6 @@ function WeakAuras.Rename(data, newid)
childData.parent = data.id; childData.parent = data.id;
end end
end end
if regions[newid].ReloadControlledChildren then
regions[newid]:ReloadControlledChildren()
end
end end
if (Private.personalRessourceDisplayFrame) then if (Private.personalRessourceDisplayFrame) then
@@ -1823,14 +1833,13 @@ end
function Private.Convert(data, newType) function Private.Convert(data, newType)
local id = data.id; local id = data.id;
regions[id].region:SetScript("OnUpdate", nil);
regions[id].region:Hide();
Private.EndEvent(id, 0, true);
Private.FakeStatesFor(id, false) Private.FakeStatesFor(id, false)
regions[id].region = nil; if WeakAuras.regions[id] then
regions[id] = nil; WeakAuras.regions[id].region = nil
WeakAuras.regions[id] = nil
end
data.regionType = newType; data.regionType = newType;
@@ -2113,7 +2122,9 @@ function WeakAuras.AddMany(table, takeSnapshots)
end end
for data in pairs(groups) do for data in pairs(groups) do
if data.type == "dynamicgroup" then if data.type == "dynamicgroup" then
regions[data.id].region:ReloadControlledChildren() if WeakAuras.regions[data.id] then
WeakAuras.regions[data.id].region:ReloadControlledChildren()
end
else else
WeakAuras.Add(data) WeakAuras.Add(data)
end end
@@ -2418,6 +2429,36 @@ function Private.UpdateSoundIcon(data)
end end
function Private.ClearSounds(uid)
local data = Private.GetDataByUID(uid)
for child in Private.TraverseLeafsOrAura(data) do
local changed = false
-- Conditions
if child.conditions then
for _, condition in ipairs(child.conditions) do
for changeIndex = #condition.changes, 1, -1 do
local change = condition.changes[changeIndex]
if change.property == "sound" then
tremove(condition.changes, changeIndex)
changed = true
end
end
end
end
-- Actions
if child.actions.start.do_sound or child.actions.finish.do_sound then
child.actions.start.do_sound = false
child.actions.finish.do_sound = false
changed = true
end
if changed then
WeakAuras.Add(child)
end
end
WeakAuras.ClearAndUpdateOptions(data.id, true)
WeakAuras.FillOptions()
end
function WeakAuras.PreAdd(data) function WeakAuras.PreAdd(data)
-- Readd what Compress removed before version 8 -- Readd what Compress removed before version 8
if (not data.internalVersion or data.internalVersion < 7) then if (not data.internalVersion or data.internalVersion < 7) then
@@ -2489,7 +2530,9 @@ local function pAdd(data, simpleChange)
if simpleChange then if simpleChange then
db.displays[id] = data db.displays[id] = data
WeakAuras.SetRegion(data) if WeakAuras.GetRegion(data.id) then
WeakAuras.SetRegion(data)
end
if clones[id] then if clones[id] then
for cloneId, region in pairs(clones[id]) do for cloneId, region in pairs(clones[id]) do
WeakAuras.SetRegion(data, cloneId) WeakAuras.SetRegion(data, cloneId)
@@ -2503,7 +2546,9 @@ local function pAdd(data, simpleChange)
Private.ClearAuraEnvironment(parent.id); Private.ClearAuraEnvironment(parent.id);
end end
db.displays[id] = data; db.displays[id] = data;
WeakAuras.SetRegion(data); if WeakAuras.GetRegion(data.id) then
WeakAuras.SetRegion(data)
end
Private.ScanForLoadsGroup({[id] = true}); Private.ScanForLoadsGroup({[id] = true});
loadEvents["GROUP"] = loadEvents["GROUP"] or {} loadEvents["GROUP"] = loadEvents["GROUP"] or {}
loadEvents["GROUP"][id] = true loadEvents["GROUP"][id] = true
@@ -2572,7 +2617,9 @@ local function pAdd(data, simpleChange)
timers[id] = nil; timers[id] = nil;
end end
local region = WeakAuras.SetRegion(data); if WeakAuras.GetRegion(data.id) then
WeakAuras.SetRegion(data)
end
triggerState[id] = { triggerState[id] = {
disjunctive = data.triggers.disjunctive or "all", disjunctive = data.triggers.disjunctive or "all",
@@ -2648,7 +2695,7 @@ function WeakAuras.SetRegion(data, cloneId)
if(clonePool[data.regionType] and clonePool[data.regionType][1]) then if(clonePool[data.regionType] and clonePool[data.regionType][1]) then
clones[id][cloneId] = tremove(clonePool[data.regionType]); clones[id][cloneId] = tremove(clonePool[data.regionType]);
else else
local clone = regionTypes[data.regionType].create(frame, data); local clone = regionTypes[data.regionType].create(WeakAurasFrame, data);
clone.regionType = data.regionType; clone.regionType = data.regionType;
clone:Hide(); clone:Hide();
clones[id][cloneId] = clone; clones[id][cloneId] = clone;
@@ -2656,9 +2703,9 @@ function WeakAuras.SetRegion(data, cloneId)
region = clones[id][cloneId]; region = clones[id][cloneId];
end end
else else
if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then if((not WeakAuras.regions[id]) or (not WeakAuras.regions[id].region) or WeakAuras.regions[id].regionType ~= regionType) then
region = regionTypes[regionType].create(frame, data); region = regionTypes[regionType].create(WeakAurasFrame, data);
regions[id] = { WeakAuras.regions[id] = {
regionType = regionType, regionType = regionType,
region = region region = region
}; };
@@ -2669,17 +2716,17 @@ function WeakAuras.SetRegion(data, cloneId)
region.toShow = true region.toShow = true
end end
else else
region = regions[id].region; region = WeakAuras.regions[id].region
end end
end end
region.id = id; region.id = id;
region.cloneId = cloneId or ""; region.cloneId = cloneId or "";
WeakAuras.validate(data, regionTypes[regionType].default); WeakAuras.validate(data, regionTypes[regionType].default);
local parent = frame; local parent = WeakAurasFrame;
if(data.parent) then if(data.parent) then
if(regions[data.parent]) then if WeakAuras.GetData(data.parent) then
parent = regions[data.parent].region; parent = Private.EnsureRegion(data.parent)
else else
data.parent = nil; data.parent = nil;
end end
@@ -2717,19 +2764,78 @@ function WeakAuras.SetRegion(data, cloneId)
end end
local function EnsureClone(id, cloneId) local function EnsureClone(id, cloneId)
clones[id] = clones[id] or {}; clones[id] = clones[id] or {}
if not(clones[id][cloneId]) then if not(clones[id][cloneId]) then
local data = WeakAuras.GetData(id); local data = WeakAuras.GetData(id)
WeakAuras.SetRegion(data, cloneId); WeakAuras.SetRegion(data, cloneId)
end end
return clones[id][cloneId]; return clones[id][cloneId]
end end
function WeakAuras.GetRegion(id, cloneId) local creatingRegions = false
function Private.CreatingRegions()
return creatingRegions
end
--- Ensures that a region exists
local function EnsureRegion(id)
if not WeakAuras.regions[id] or not WeakAuras.regions[id].region then
WeakAuras.regions[id] = WeakAuras.regions[id] or {}
-- The region doesn't yet exist
-- But we must also ensure that our parents exists
-- and as an additional wrinkle, for dynamic groups, all children must exist!
-- and we have to call ReloadControlledChildren at the end
-- So we go up the list of parents and collect auras that must be created
-- If we find a parent already exists, we can stop
-- And dynamic groups require creating all children, thus we don't need
-- to care which path we came to them
local aurasToCreate = {}
local dynamicGroups = {}
creatingRegions = true
while(id) do
local data = WeakAuras.GetData(id)
if (data.regionType == "dynamicgroup") then
wipe(aurasToCreate)
tinsert(aurasToCreate, data.id)
tinsert(dynamicGroups, data.id)
else
tinsert(aurasToCreate, data.id)
end
id = data.parent
end
for _, toCreateId in ipairs_reverse(aurasToCreate) do
local data = WeakAuras.GetData(toCreateId)
WeakAuras.SetRegion(data)
if (data.regionType == "dynamicgroup") then
for child in Private.TraverseAllChildren(data) do
WeakAuras.SetRegion(child)
end
end
end
creatingRegions = false
for _, dynamicGroupId in ipairs_reverse(dynamicGroups) do
local dgRegion = WeakAuras.regions[dynamicGroupId].region
dgRegion:ReloadControlledChildren()
end
end
return WeakAuras.regions[id] and WeakAuras.regions[id].region
end
--- Ensures that a region/clone exists and returns it
-- Even if we are asked to only create a clone, we create the default region too.
function Private.EnsureRegion(id, cloneId)
EnsureRegion(id)
if(cloneId and cloneId ~= "") then if(cloneId and cloneId ~= "") then
return EnsureClone(id, cloneId); return EnsureClone(id, cloneId);
end end
return WeakAuras.regions[id] and WeakAuras.regions[id].region; return WeakAuras.GetRegion(id)
end
---returns the region, if it exists
function WeakAuras.GetRegion(id, cloneId)
if(cloneId and cloneId ~= "") then
return clones[id] and clones[id][cloneId]
end
return WeakAuras.regions[id] and WeakAuras.regions[id].region
end end
-- Note, does not create a clone! -- Note, does not create a clone!
@@ -2960,8 +3066,11 @@ function Private.HandleGlowAction(actions, region)
if actions.glow_frame_type == "FRAMESELECTOR" then if actions.glow_frame_type == "FRAMESELECTOR" then
if actions.glow_frame:sub(1, 10) == "WeakAuras:" then if actions.glow_frame:sub(1, 10) == "WeakAuras:" then
local frame_name = actions.glow_frame:sub(11) local frame_name = actions.glow_frame:sub(11)
if regions[frame_name] then if WeakAuras.GetData(frame_name) then
glow_frame = regions[frame_name].region Private.EnsureRegion(frame_name)
end
if WeakAuras.regions[frame_name] then
glow_frame = WeakAuras.regions[frame_name].region
end end
else else
glow_frame = Private.GetSanitizedGlobal(actions.glow_frame) glow_frame = Private.GetSanitizedGlobal(actions.glow_frame)
@@ -3534,7 +3643,7 @@ do
local UpdateFakeTimesHandle local UpdateFakeTimesHandle
local function UpdateFakeTimers() local function UpdateFakeTimers()
Private.PauseAllDynamicGroups() local suspended = Private.PauseAllDynamicGroups()
local t = GetTime() local t = GetTime()
for id, triggers in pairs(triggerState) do for id, triggers in pairs(triggerState) do
local changed = false local changed = false
@@ -3551,7 +3660,7 @@ do
Private.UpdatedTriggerState(id) Private.UpdatedTriggerState(id)
end end
end end
Private.ResumeAllDynamicGroups() Private.ResumeAllDynamicGroups(suspended)
end end
function Private.SetFakeStates() function Private.SetFakeStates()
@@ -3738,14 +3847,14 @@ local function ApplyStatesToRegions(id, activeTrigger, states)
local data = WeakAuras.GetData(id) local data = WeakAuras.GetData(id)
local parent local parent
if data and data.parent then if data and data.parent then
parent = WeakAuras.GetRegion(data.parent) parent = Private.EnsureRegion(data.parent)
end end
if parent and parent.Suspend then if parent and parent.Suspend then
parent:Suspend() parent:Suspend()
end end
for cloneId, state in pairs(states) do for cloneId, state in pairs(states) do
if (state.show) then if (state.show) then
local region = WeakAuras.GetRegion(id, cloneId); local region = Private.EnsureRegion(id, cloneId);
local applyChanges = not region.toShow or state.changed or region.state ~= state local applyChanges = not region.toShow or state.changed or region.state ~= state
region.state = state region.state = state
region.states = region.states or {} region.states = region.states or {}
@@ -3876,7 +3985,9 @@ function Private.UpdatedTriggerState(id)
for cloneId, clone in pairs(clones[id]) do for cloneId, clone in pairs(clones[id]) do
clone:Collapse() clone:Collapse()
end end
WeakAuras.regions[id].region:Collapse() if WeakAuras.regions[id] then
WeakAuras.regions[id].region:Collapse()
end
elseif (show and oldShow) then -- Already shown, update regions elseif (show and oldShow) then -- Already shown, update regions
-- Hide old clones -- Hide old clones
for cloneId, clone in pairs(clones[id]) do for cloneId, clone in pairs(clones[id]) do
@@ -3885,7 +3996,9 @@ function Private.UpdatedTriggerState(id)
end end
end end
if (not activeTriggerState[""] or not activeTriggerState[""].show) then if (not activeTriggerState[""] or not activeTriggerState[""].show) then
WeakAuras.regions[id].region:Collapse() if WeakAuras.regions[id] then
WeakAuras.regions[id].region:Collapse()
end
end end
-- Show new states -- Show new states
ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState);
@@ -4649,9 +4762,9 @@ local function tryAnchorAgain()
local data = WeakAuras.GetData(id); local data = WeakAuras.GetData(id);
local region = WeakAuras.GetRegion(id); local region = WeakAuras.GetRegion(id);
if (data and region) then if (data and region) then
local parent = frame; local parent = WeakAurasFrame;
if (data.parent and regions[data.parent]) then if (data.parent and WeakAuras.GetData(data.parent) and Private.EnsureRegion(data.parent)) then
parent = regions[data.parent].region; parent = WeakAuras.regions[data.parent].region;
end end
Private.AnchorFrame(data, region, parent); Private.AnchorFrame(data, region, parent);
end end
@@ -4728,8 +4841,8 @@ local function GetAnchorFrame(data, region, parent)
if (frame_name == id) then if (frame_name == id) then
return parent; return parent;
end end
if(regions[frame_name]) then if(WeakAuras.regions[frame_name]) then
return regions[frame_name].region; return WeakAuras.regions[frame_name].region;
end end
postponeAnchor(id); postponeAnchor(id);
else else
@@ -4786,7 +4899,7 @@ function Private.AnchorFrame(data, region, parent, force)
errorhandler(ret) errorhandler(ret)
end end
else else
region:SetParent(parent or frame); region:SetParent(parent or WeakAurasFrame);
end end
local anchorPoint = data.anchorPoint local anchorPoint = data.anchorPoint
@@ -5273,6 +5386,11 @@ do
function Private.TraverseParents(data) function Private.TraverseParents(data)
return coroutine.wrap(TraverseParents), data return coroutine.wrap(TraverseParents), data
end end
-- Returns whether the data is a group or dynamicgroup
function Private.IsGroupType(data)
return data.regionType == "group" or data.regionType == "dynamicgroup"
end
end end
+3 -1
View File
@@ -1,7 +1,7 @@
## Interface: 30300 ## Interface: 30300
## Title: WeakAuras ## Title: WeakAuras
## Author: The WeakAuras Team ## Author: The WeakAuras Team
## Version: 4.1.1 ## Version: 4.1.2
## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers. ## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers.
## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores. ## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores.
## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr. ## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr.
@@ -17,6 +17,8 @@
## SavedVariables: WeakAurasSaved ## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0 ## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0
Templates.lua
Templates.xml
compat.lua compat.lua
Pools.lua Pools.lua
@@ -5,7 +5,7 @@ local tinsert, tconcat, tremove, wipe = table.insert, table.concat, table.remove
local select, pairs, next, type, unpack = select, pairs, next, type, unpack local select, pairs, next, type, unpack = select, pairs, next, type, unpack
local tostring, error = tostring, error local tostring, error = tostring, error
local Type, Version = "WeakAurasDisplayButton", 57 local Type, Version = "WeakAurasDisplayButton", 59
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
@@ -236,6 +236,7 @@ end
local function Show_Tooltip(owner, line1, line2) local function Show_Tooltip(owner, line1, line2)
GameTooltip:SetOwner(owner, "ANCHOR_NONE"); GameTooltip:SetOwner(owner, "ANCHOR_NONE");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("LEFT", owner, "RIGHT"); GameTooltip:SetPoint("LEFT", owner, "RIGHT");
GameTooltip:ClearLines(); GameTooltip:ClearLines();
GameTooltip:AddLine(line1); GameTooltip:AddLine(line1);
@@ -245,6 +246,7 @@ end
local function Show_Long_Tooltip(owner, description) local function Show_Long_Tooltip(owner, description)
GameTooltip:SetOwner(owner, "ANCHOR_NONE"); GameTooltip:SetOwner(owner, "ANCHOR_NONE");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("LEFT", owner, "RIGHT"); GameTooltip:SetPoint("LEFT", owner, "RIGHT");
GameTooltip:ClearLines(); GameTooltip:ClearLines();
local line = 1; local line = 1;
@@ -272,6 +274,8 @@ local function ensure(t, k, v)
return t and k and v and t[k] == v return t and k and v and t[k] == v
end end
local statusIconPool = CreateFramePool("Button")
--[[ Actions ]]-- --[[ Actions ]]--
local Actions = { local Actions = {
@@ -303,19 +307,17 @@ local Actions = {
WeakAuras.UpdateGroupOrders(group.data) WeakAuras.UpdateGroupOrders(group.data)
WeakAuras.ClearAndUpdateOptions(group.data.id) WeakAuras.ClearAndUpdateOptions(group.data.id)
WeakAuras.ClearAndUpdateOptions(source.data.id) WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
group.callbacks.UpdateExpandButton(); group.callbacks.UpdateExpandButton();
group:UpdateParentWarning()
group:ReloadTooltip() group:ReloadTooltip()
else else
WeakAuras.Add(source.data) WeakAuras.Add(source.data)
WeakAuras.ClearAndUpdateOptions(source.data.id) WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
end end
else else
-- move source into the top-level list -- move source into the top-level list
WeakAuras.Add(source.data) WeakAuras.Add(source.data)
WeakAuras.ClearAndUpdateOptions(source.data.id) WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
end end
else else
error("Calling 'Group' with invalid source. Reload your UI to fix the display list.") error("Calling 'Group' with invalid source. Reload your UI to fix the display list.")
@@ -337,6 +339,7 @@ local Actions = {
WeakAuras.ClearAndUpdateOptions(parent.id); WeakAuras.ClearAndUpdateOptions(parent.id);
local group = WeakAuras.GetDisplayButton(parent.id) local group = WeakAuras.GetDisplayButton(parent.id)
group.callbacks.UpdateExpandButton(); group.callbacks.UpdateExpandButton();
group:UpdateParentWarning()
group:ReloadTooltip() group:ReloadTooltip()
else else
error("Display thinks it is a member of a group which does not control it") error("Display thinks it is a member of a group which does not control it")
@@ -425,6 +428,12 @@ local function IsParentRecursive(needle, parent)
end end
end end
local tabsForWarning = {
sound_condition = "conditions",
sound_action = "action",
spammy_event_warning = "trigger"
}
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Methods Methods
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -474,7 +483,11 @@ local methods = {
UpdateClipboardMenuEntry(self.data); UpdateClipboardMenuEntry(self.data);
EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU"); EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU");
if not(OptionsPrivate.IsDisplayPicked(self.data.id)) then if not(OptionsPrivate.IsDisplayPicked(self.data.id)) then
WeakAuras.PickDisplay(self.data.id); if self.data.controlledChildren then
WeakAuras.PickDisplay(self.data.id, "group")
else
WeakAuras.PickDisplay(self.data.id);
end
end end
end end
else else
@@ -531,6 +544,7 @@ local methods = {
WeakAuras.Add(self.data); WeakAuras.Add(self.data);
OptionsPrivate.Private.AddParents(self.data) OptionsPrivate.Private.AddParents(self.data)
self.callbacks.UpdateExpandButton(); self.callbacks.UpdateExpandButton();
self:UpdateParentWarning();
OptionsPrivate.StopGrouping(); OptionsPrivate.StopGrouping();
OptionsPrivate.ClearOptions(self.data.id); OptionsPrivate.ClearOptions(self.data.id);
WeakAuras.FillOptions(); WeakAuras.FillOptions();
@@ -600,22 +614,24 @@ local methods = {
-- This builds the group skeleton -- This builds the group skeleton
DuplicateGroups(self.data, newGroup, mapping) DuplicateGroups(self.data, newGroup, mapping)
-- Do this after duplicating all groups -- Do this after duplicating all groups
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
-- And this fills in the leafs -- And this fills in the leafs
DuplicateAuras(self.data, newGroup, mapping) DuplicateAuras(self.data, newGroup, mapping)
local button = WeakAuras.GetDisplayButton(newGroup.id) local button = WeakAuras.GetDisplayButton(newGroup.id)
button.callbacks.UpdateExpandButton() button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
for old, new in pairs(mapping) do for old, new in pairs(mapping) do
local button = WeakAuras.GetDisplayButton(new.id) local button = WeakAuras.GetDisplayButton(new.id)
button.callbacks.UpdateExpandButton() button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
end end
OptionsPrivate.SortDisplayButtons(nil, true) OptionsPrivate.SortDisplayButtons(nil, true)
OptionsPrivate.PickAndEditDisplay(newGroup.id) OptionsPrivate.PickAndEditDisplay(newGroup.id)
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
else else
local new = OptionsPrivate.DuplicateAura(self.data) local new = OptionsPrivate.DuplicateAura(self.data)
OptionsPrivate.SortDisplayButtons(nil, true) OptionsPrivate.SortDisplayButtons(nil, true)
@@ -627,7 +643,6 @@ local methods = {
if (WeakAuras.IsImporting()) then return end; if (WeakAuras.IsImporting()) then return end;
local toDelete = {} local toDelete = {}
if(self.data.controlledChildren) then if(self.data.controlledChildren) then
local region = WeakAuras.regions[self.data.id];
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
tinsert(toDelete, child); tinsert(toDelete, child);
end end
@@ -721,7 +736,7 @@ local methods = {
end end
function self.callbacks.OnViewClick() function self.callbacks.OnViewClick()
OptionsPrivate.Private.PauseAllDynamicGroups(); local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if(self.view.visibility == 2) then if(self.view.visibility == 2) then
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
WeakAuras.GetDisplayButton(child.id):PriorityHide(2); WeakAuras.GetDisplayButton(child.id):PriorityHide(2);
@@ -734,7 +749,7 @@ local methods = {
self:PriorityShow(2) self:PriorityShow(2)
end end
self:RecheckParentVisibility() self:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups(); OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end end
function self.callbacks.OnRenameClick() function self.callbacks.OnRenameClick()
@@ -755,6 +770,7 @@ local methods = {
if not(newid == oldid) then if not(newid == oldid) then
WeakAuras.Rename(self.data, newid); WeakAuras.Rename(self.data, newid);
end end
self:UpdateParentWarning()
end end
function self.callbacks.OnDragStart() function self.callbacks.OnDragStart()
@@ -889,13 +905,10 @@ local methods = {
func = function() WeakAuras_DropDownMenu:Hide() end func = function() WeakAuras_DropDownMenu:Hide() end
}); });
if(self.data.controlledChildren) then if(self.data.controlledChildren) then
self.loaded:Hide();
self.expand:Show(); self.expand:Show();
self.callbacks.UpdateExpandButton(); self.callbacks.UpdateExpandButton();
self:SetOnExpandCollapse(function() OptionsPrivate.SortDisplayButtons(nil, true) end); self:SetOnExpandCollapse(function() OptionsPrivate.SortDisplayButtons(nil, true) end);
else else
self:SetViewRegion(WeakAuras.regions[self.data.id].region);
self.loaded:Show();
self.expand:Hide(); self.expand:Hide();
end end
self.group:Show(); self.group:Show();
@@ -945,6 +958,9 @@ local methods = {
for index, childId in pairs(data.controlledChildren) do for index, childId in pairs(data.controlledChildren) do
tinsert(namestable, indent .. childId); tinsert(namestable, indent .. childId);
local childData = WeakAuras.GetData(childId) local childData = WeakAuras.GetData(childId)
if not childData then
return
end
if (childData.controlledChildren) then if (childData.controlledChildren) then
addChildrenNames(childData, indent .. " ") addChildrenNames(childData, indent .. " ")
end end
@@ -1011,13 +1027,13 @@ local methods = {
Show_Long_Tooltip(self.frame, self.frame.description); Show_Long_Tooltip(self.frame, self.frame.description);
end end
end, end,
["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouing) ["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouping)
self.grouping = groupingData; self.grouping = groupingData;
self:UpdateIconsVisible() self:UpdateIconsVisible()
if(selected) then if(selected) then
self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf); self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf);
self:SetDescription(L["Cancel"], L["Do not group this display"]); self:SetDescription(L["Cancel"], L["Do not group this display"]);
elseif (childOfGrouing) then elseif (childOfGrouping) then
self:Disable(); self:Disable();
else else
if(self.data.regionType == "dynamicgroup" and groupingGroup) then if(self.data.regionType == "dynamicgroup" and groupingGroup) then
@@ -1031,11 +1047,13 @@ local methods = {
end end
end, end,
["StopGrouping"] = function(self) ["StopGrouping"] = function(self)
self.grouping = nil; if self.grouping then
self:UpdateIconsVisible() self.grouping = nil
self:SetNormalTooltip(); self:UpdateIconsVisible()
self.frame:SetScript("OnClick", self.callbacks.OnClickNormal); self:SetNormalTooltip()
self:Enable(); self.frame:SetScript("OnClick", self.callbacks.OnClickNormal)
self:Enable()
end
end, end,
["Ungroup"] = function(self) ["Ungroup"] = function(self)
if (WeakAuras.IsImporting()) then return end; if (WeakAuras.IsImporting()) then return end;
@@ -1073,10 +1091,11 @@ local methods = {
end end
WeakAuras.ClearAndUpdateOptions(self.data.id); WeakAuras.ClearAndUpdateOptions(self.data.id);
WeakAuras.UpdateGroupOrders(parentData); WeakAuras.UpdateGroupOrders(parentData);
local parentButton = WeakAuras.GetDisplayButton(parentData.id)
if(#parentData.controlledChildren == 0) then if(#parentData.controlledChildren == 0) then
local parentButton = WeakAuras.GetDisplayButton(parentData.id)
parentButton:DisableExpand() parentButton:DisableExpand()
end end
parentButton:UpdateParentWarning()
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
local button = WeakAuras.GetDisplayButton(child.id) local button = WeakAuras.GetDisplayButton(child.id)
@@ -1108,7 +1127,7 @@ local methods = {
self.frame:SetScript("OnClick", nil) self.frame:SetScript("OnClick", nil)
self.view:Hide() self.view:Hide()
self.expand:Hide() self.expand:Hide()
self.loaded:Hide() self.statusIcons:Hide()
Hide_Tooltip() Hide_Tooltip()
if picked then if picked then
self.frame:EnableKeyboard(true) self.frame:EnableKeyboard(true)
@@ -1152,7 +1171,6 @@ local methods = {
Show_DropIndicator(id) Show_DropIndicator(id)
end end
self:UpdateIconsVisible() self:UpdateIconsVisible()
OptionsPrivate.UpdateButtonsScroll()
else else
-- Are we a valid target? -- Are we a valid target?
-- Top level auras that aren't groups aren't -- Top level auras that aren't groups aren't
@@ -1201,10 +1219,9 @@ local methods = {
self.frame:SetScript("OnClick", self.callbacks.OnClickNormal) self.frame:SetScript("OnClick", self.callbacks.OnClickNormal)
self.frame:EnableKeyboard(false); -- disables self.callbacks.OnKeyDown self.frame:EnableKeyboard(false); -- disables self.callbacks.OnKeyDown
self.view:Show() self.view:Show()
self.statusIcons:Show()
if self.data.controlledChildren then if self.data.controlledChildren then
self.expand:Show() self.expand:Show()
else
self.loaded:Show()
end end
self:Enable() self:Enable()
@@ -1255,9 +1272,6 @@ local methods = {
["SetDescription"] = function(self, ...) ["SetDescription"] = function(self, ...)
self.frame.description = {...}; self.frame.description = {...};
end, end,
["SetViewRegion"] = function(self, region)
self.view.region = region;
end,
["SetRenameAction"] = function(self, func) ["SetRenameAction"] = function(self, func)
self.renamebox.func = function() self.renamebox.func = function()
func(self.renamebox:GetText()); func(self.renamebox:GetText());
@@ -1329,12 +1343,18 @@ local methods = {
return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true) return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true)
end, end,
["DisableExpand"] = function(self) ["DisableExpand"] = function(self)
if self.expand.disabled then
return
end
self.expand:Disable(); self.expand:Disable();
self.expand.disabled = true; self.expand.disabled = true;
self.expand.expanded = false; self.expand.expanded = false;
self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp"); self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp");
end, end,
["EnableExpand"] = function(self) ["EnableExpand"] = function(self)
if not self.expand.disabled then
return
end
self.expand.disabled = false; self.expand.disabled = false;
if(self:GetExpanded()) then if(self:GetExpanded()) then
self:Expand(); self:Expand();
@@ -1342,23 +1362,119 @@ local methods = {
self:Collapse(); self:Collapse();
end end
end, end,
["UpdateWarning"] = function(self) ["UpdateStatusIcon"] = function(self, key, prio, icon, title, tooltip, onClick, color)
local icon, title, warningText = OptionsPrivate.Private.AuraWarnings.FormatWarnings(self.data.uid) local iconButton
if warningText then for _, button in ipairs(self.statusIcons.buttons) do
self.warning:Show() if button.key == key then
self.warning:SetNormalTexture(icon) iconButton = button
self.warning:SetScript("OnEnter", function() break
end
end
if not iconButton then
iconButton = statusIconPool:Acquire()
iconButton:RegisterForClicks("LeftButtonUp", "RightButtonUp")
tinsert(self.statusIcons.buttons, iconButton)
iconButton:SetParent(self.statusIcons)
iconButton.key = key
iconButton:SetSize(16, 16)
end
iconButton.prio = prio
iconButton:SetNormalTexture(icon.path)
if icon.texCoords then
iconButton:GetNormalTexture():SetTexCoord(unpack(icon.texCoords))
end
if title then
iconButton:SetScript("OnEnter", function()
Show_Tooltip( Show_Tooltip(
self.frame, self.frame,
title, title,
warningText tooltip
) )
end) end)
self.warning:SetScript("OnClick", function() iconButton:SetScript("OnLeave", Hide_Tooltip)
WeakAuras.PickDisplay(self.data.id, "information")
end)
else else
self.warning:Hide() iconButton:SetScript("OnEnter", nil)
end
if color then
iconButton:GetNormalTexture():SetVertexColor(unpack(color))
else
iconButton:GetNormalTexture():SetVertexColor(1, 1, 1, 1)
end
iconButton:SetScript("OnClick", onClick)
iconButton:Show()
end,
["ClearStatusIcon"] = function(self, key)
for index, button in ipairs(self.statusIcons.buttons) do
if button.key == key then
statusIconPool:Release(button)
table.remove(self.statusIcons.buttons, index)
return
end
end
end,
["SortStatusIcons"] = function(self)
table.sort(self.statusIcons.buttons, function(a, b)
return a.prio < b.prio
end)
local lastAnchor = self.statusIcons
if self:IsGroup() then
self.statusIcons:SetWidth(17)
else
self.statusIcons:SetWidth(1)
end
for _, button in ipairs(self.statusIcons.buttons) do
button:ClearAllPoints()
button:SetPoint("BOTTOMLEFT", lastAnchor, "BOTTOMRIGHT", 4, 0)
lastAnchor = button
end
end,
["UpdateWarning"] = function(self)
local warnings = OptionsPrivate.Private.AuraWarnings.GetAllWarnings(self.data.uid)
local warningTypes = {"info", "sound", "warning", "error"}
for _, key in ipairs(warningTypes) do
self:ClearStatusIcon(key)
end
if warnings then
for severity, warning in pairs(warnings) do
local onClick
if severity == "sound" then
local soundText = L["Show Sound Setting"]
local removeText = L["Remove All Sounds"]
onClick = function()
local menu = {
{
text = soundText,
func = function()
WeakAuras.PickDisplay(warning.auraId, tabsForWarning[warning.key] or "information")
end
},
{
text = removeText,
func = function()
OptionsPrivate.Private.ClearSounds(self.data.uid)
end
}
}
EasyMenu(menu, WeakAuras_DropDownMenu, "cursor", 0, 0, "MENU");
end
else
onClick = function()
WeakAuras.PickDisplay(warning.auraId, tabsForWarning[warning.key] or "information")
end
end
self:UpdateStatusIcon(severity, warning.prio, warning.icon, warning.title, warning.message, onClick)
end
end
self:SortStatusIcons()
end,
["UpdateParentWarning"] = function(self)
self:UpdateWarning()
for parent in OptionsPrivate.Private.TraverseParents(self.data) do
local parentButton = WeakAuras.GetDisplayButton(parent.id)
if parentButton then
parentButton:UpdateWarning()
end
end end
end, end,
["SetGroupOrder"] = function(self, order, max) ["SetGroupOrder"] = function(self, order, max)
@@ -1387,15 +1503,22 @@ local methods = {
["GetGroupOrder"] = function(self) ["GetGroupOrder"] = function(self)
return self.frame.dgrouporder; return self.frame.dgrouporder;
end, end,
["DisableLoaded"] = function(self) ["ClearLoaded"] = function(self)
self.loaded.title = L["Not Loaded"]; self:ClearStatusIcon("load")
self.loaded.desc = L["This display is not currently loaded"]; self:SortStatusIcons()
self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp");
end, end,
["EnableLoaded"] = function(self) ["SetLoaded"] = function(self, prio, color, title, description)
self.loaded.title = L["Loaded"]; self:UpdateStatusIcon("load", prio, {path="Interface\\AddOns\\WeakAuras\\Media\\Textures\\loaded"}, title, description, nil, color)
self.loaded.desc = L["This display is currently loaded"]; self:SortStatusIcons()
self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp"); end,
["IsLoaded"] = function(self)
return OptionsPrivate.Private.loaded[self.data.id] == true
end,
["IsStandby"] = function(self)
return OptionsPrivate.Private.loaded[self.data.id] == false
end,
["IsUnloaded"] = function(self)
return OptionsPrivate.Private.loaded[self.data.id] == nil
end, end,
["Pick"] = function(self) ["Pick"] = function(self)
self.frame:LockHighlight(); self.frame:LockHighlight();
@@ -1414,24 +1537,25 @@ local methods = {
return; return;
end end
if self.view.visibility >= 1 then if self.view.visibility >= 1 then
if(self.view.region and self.view.region.Expand) then
OptionsPrivate.Private.FakeStatesFor(self.view.region.id, true) if not OptionsPrivate.Private.IsGroupType(self.data) then
--if (OptionsPrivate.Private.personalRessourceDisplayFrame) then OptionsPrivate.Private.FakeStatesFor(self.data.id, true)
--OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.view.region.id); end
--end --if (OptionsPrivate.Private.personalRessourceDisplayFrame) then
if (OptionsPrivate.Private.mouseFrame) then --OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.data.id);
OptionsPrivate.Private.mouseFrame:expand(self.view.region.id); --end
end if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:expand(self.data.id);
end end
else else
if(self.view.region and self.view.region.Collapse) then if not OptionsPrivate.Private.IsGroupType(self.data) then
OptionsPrivate.Private.FakeStatesFor(self.view.region.id, false) OptionsPrivate.Private.FakeStatesFor(self.data.id, false)
if (OptionsPrivate.Private.personalRessourceDisplayFrame) then end
OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.view.region.id); if (OptionsPrivate.Private.personalRessourceDisplayFrame) then
end OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.data.id);
if (OptionsPrivate.Private.mouseFrame) then end
OptionsPrivate.Private.mouseFrame:collapse(self.view.region.id); if (OptionsPrivate.Private.mouseFrame) then
end OptionsPrivate.Private.mouseFrame:collapse(self.data.id);
end end
end end
end, end,
@@ -1444,8 +1568,9 @@ local methods = {
self:SyncVisibility() self:SyncVisibility()
self:UpdateViewTexture() self:UpdateViewTexture()
end end
if self.view.region and self.view.region.ClickToPick then local region = OptionsPrivate.Private.EnsureRegion(self.data.id)
self.view.region:ClickToPick(); if region and region.ClickToPick then
region:ClickToPick();
end end
end, end,
["PriorityHide"] = function(self, priority) ["PriorityHide"] = function(self, priority)
@@ -1495,12 +1620,6 @@ local methods = {
self:RecheckParentVisibility() self:RecheckParentVisibility()
end end
end, end,
["SetVisibilityDirectly"] = function(self, visibility)
if self.data.parent and visibility ~= self.view.visibility then
self.view.visibility = visibility
self:UpdateViewTexture()
end
end,
["UpdateViewTexture"] = function(self) ["UpdateViewTexture"] = function(self)
local visibility = self.view.visibility local visibility = self.view.visibility
if(visibility == 2) then if(visibility == 2) then
@@ -1520,8 +1639,10 @@ local methods = {
self.view:Disable(); self.view:Disable();
self.group:Disable(); self.group:Disable();
self.ungroup:Disable(); self.ungroup:Disable();
self.loaded:Disable();
self.expand:Disable(); self.expand:Disable();
for _, button in ipairs(self.statusIcons.buttons) do
button:Disable();
end
self:UpdateUpDownButtons() self:UpdateUpDownButtons()
end, end,
["Enable"] = function(self) ["Enable"] = function(self)
@@ -1530,7 +1651,9 @@ local methods = {
self.view:Enable(); self.view:Enable();
self.group:Enable(); self.group:Enable();
self.ungroup:Enable(); self.ungroup:Enable();
self.loaded:Enable(); for _, button in ipairs(self.statusIcons.buttons) do
button:Enable();
end
self:UpdateUpDownButtons() self:UpdateUpDownButtons()
if not(self.expand.disabled) then if not(self.expand.disabled) then
self.expand:Enable(); self.expand:Enable();
@@ -1541,7 +1664,6 @@ local methods = {
end, end,
["OnRelease"] = function(self) ["OnRelease"] = function(self)
self:ReleaseThumbnail() self:ReleaseThumbnail()
self:SetViewRegion();
self:Enable(); self:Enable();
self:SetGroup(); self:SetGroup();
self.renamebox:Hide(); self.renamebox:Hide();
@@ -1555,6 +1677,10 @@ local methods = {
--self.frame:EnableMouse(false); --self.frame:EnableMouse(false);
self.frame:ClearAllPoints(); self.frame:ClearAllPoints();
self.frame:Hide(); self.frame:Hide();
for _, button in ipairs(self.statusIcons.buttons) do
statusIconPool:Release(button)
end
wipe(self.statusIcons.buttons)
self.frame = nil; self.frame = nil;
self.data = nil; self.data = nil;
end, end,
@@ -1644,7 +1770,8 @@ Constructor
local function Constructor() local function Constructor()
local name = "WeakAurasDisplayButton"..AceGUI:GetNextWidgetNum(Type); local name = "WeakAurasDisplayButton"..AceGUI:GetNextWidgetNum(Type);
local button = CreateFrame("BUTTON", name, UIParent, "OptionsListButtonTemplate"); ---@class Button
local button = CreateFrame("Button", name, UIParent, "OptionsListButtonTemplate");
button:SetHeight(32); button:SetHeight(32);
button:SetWidth(1000); button:SetWidth(1000);
button.dgroup = nil; button.dgroup = nil;
@@ -1683,7 +1810,8 @@ local function Constructor()
button.description = {}; button.description = {};
local view = CreateFrame("BUTTON", nil, button); ---@class Button
local view = CreateFrame("Button", nil, button);
button.view = view; button.view = view;
view:SetWidth(16); view:SetWidth(16);
view:SetHeight(16); view:SetHeight(16);
@@ -1700,21 +1828,7 @@ local function Constructor()
view.visibility = 0; view.visibility = 0;
local loaded = CreateFrame("BUTTON", nil, button); local renamebox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate");
button.loaded = loaded;
loaded:SetWidth(16);
loaded:SetHeight(16);
loaded:SetPoint("BOTTOM", button, "BOTTOM");
loaded:SetPoint("LEFT", icon, "RIGHT", 0, 0);
loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp");
loaded:SetDisabledTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp");
--loaded:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp");
loaded.title = L["Loaded"];
loaded.desc = L["This display is currently loaded"];
loaded:SetScript("OnEnter", function() Show_Tooltip(button, loaded.title, loaded.desc) end);
loaded:SetScript("OnLeave", Hide_Tooltip);
local renamebox = CreateFrame("EDITBOX", nil, button, "InputBoxTemplate");
renamebox:SetHeight(14); renamebox:SetHeight(14);
renamebox:SetPoint("TOP", button, "TOP"); renamebox:SetPoint("TOP", button, "TOP");
renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0); renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0);
@@ -1821,13 +1935,12 @@ local function Constructor()
expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, expand.desc) end); expand:SetScript("OnEnter", function() Show_Tooltip(button, expand.title, expand.desc) end);
expand:SetScript("OnLeave", Hide_Tooltip); expand:SetScript("OnLeave", Hide_Tooltip);
local warning = CreateFrame("BUTTON", nil, button); local statusIcons = CreateFrame("Frame", nil, button);
button.warning = warning button.statusIcons = statusIcons
warning:SetWidth(16) statusIcons:SetPoint("BOTTOM", button, "BOTTOM", 0, 1);
warning:SetHeight(16) statusIcons:SetPoint("LEFT", icon, "RIGHT");
warning:SetPoint("RIGHT", button, "RIGHT", -60, 0) statusIcons:SetSize(1,1)
warning:SetScript("OnLeave", Hide_Tooltip) statusIcons.buttons = {}
warning:Hide()
local widget = { local widget = {
frame = button, frame = button,
@@ -1839,10 +1952,9 @@ local function Constructor()
ungroup = ungroup, ungroup = ungroup,
upgroup = upgroup, upgroup = upgroup,
downgroup = downgroup, downgroup = downgroup,
loaded = loaded,
background = background, background = background,
expand = expand, expand = expand,
warning = warning, statusIcons = statusIcons,
type = Type, type = Type,
offset = offset offset = offset
} }
@@ -1,6 +1,6 @@
if not WeakAuras.IsCorrectVersion() then return end if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasLoadedHeaderButton", 20 local Type, Version = "WeakAurasLoadedHeaderButton", 22
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
@@ -151,7 +151,7 @@ local function Constructor()
button.background = background; button.background = background;
background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp"); background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp");
background:SetBlendMode("ADD"); background:SetBlendMode("ADD");
background:SetVertexColor(0.5, 0.5, 0.5, 0.25); background:SetVertexColor(0.5, 0.5, 0.5, 0.6);
background:SetAllPoints(button); background:SetAllPoints(button);
local expand = CreateFrame("BUTTON", nil, button); local expand = CreateFrame("BUTTON", nil, button);
@@ -179,7 +179,7 @@ local function Constructor()
view:SetPoint("RIGHT", button, "RIGHT", -16, 0); view:SetPoint("RIGHT", button, "RIGHT", -16, 0);
local viewTexture = view:CreateTexture() local viewTexture = view:CreateTexture()
view.texture = viewTexture; view.texture = viewTexture;
viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking1.blp"); viewTexture:SetTexture("Interface\\LFGFrame\\BattlenetWorking4.blp");
viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); viewTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9);
viewTexture:SetAllPoints(view); viewTexture:SetAllPoints(view);
view:SetNormalTexture(viewTexture); view:SetNormalTexture(viewTexture);
@@ -84,6 +84,7 @@ end
local function OnEditFocusLost(self) -- EditBox local function OnEditFocusLost(self) -- EditBox
self:HighlightText(0, 0) self:HighlightText(0, 0)
self.obj:Fire("OnEditFocusLost") self.obj:Fire("OnEditFocusLost")
self.obj.scrollFrame:EnableMouseWheel(false);
end end
local function OnEnter(self) -- EditBox / ScrollFrame local function OnEnter(self) -- EditBox / ScrollFrame
@@ -166,6 +167,7 @@ end
local function OnEditFocusGained(frame) local function OnEditFocusGained(frame)
AceGUI:SetFocus(frame.obj) AceGUI:SetFocus(frame.obj)
frame.obj:Fire("OnEditFocusGained") frame.obj:Fire("OnEditFocusGained")
frame.obj.scrollFrame:EnableMouseWheel(true);
end end
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
@@ -314,6 +316,7 @@ local function Constructor()
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate") local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate")
scrollFrame:EnableMouseWheel(false);
local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"] local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"]
scrollBar:ClearAllPoints() scrollBar:ClearAllPoints()
@@ -189,7 +189,7 @@ local function Constructor()
deleteButton:SetPushedTexture(delPushed) deleteButton:SetPushedTexture(delPushed)
button.deleteHighlight = delHighlight button.deleteHighlight = delHighlight
local renameEditBox = CreateFrame("EditBox", nil, button, "InputBoxTemplate") local renameEditBox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate")
renameEditBox:SetHeight(14) renameEditBox:SetHeight(14)
renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT") renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT")
renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT") renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT")
@@ -277,7 +277,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local widgetName = ("%s%d"):format(Type, AceGUI:GetNextWidgetNum(Type)) -- Needs a name for 3.3.5 (InputBoxTemplate ($parent)) local widgetName = ("%s%d"):format(Type, AceGUI:GetNextWidgetNum(Type))
local frame = CreateFrame("Frame", widgetName, UIParent) local frame = CreateFrame("Frame", widgetName, UIParent)
frame:SetScript("OnEnter", Frame_OnEnter) frame:SetScript("OnEnter", Frame_OnEnter)
@@ -304,7 +304,7 @@ local function Constructor()
rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp") rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp")
rightbutton:SetScript("OnClick", SpinBox_OnValueUp) rightbutton:SetScript("OnClick", SpinBox_OnValueUp)
local editbox = CreateFrame("EditBox", nil, frame, "InputBoxTemplate") local editbox = CreateFrame("EditBox", nil, frame, "WA_InputBoxTemplate")
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal) editbox:SetFontObject(ChatFontNormal)
editbox:SetHeight(19) editbox:SetHeight(19)
@@ -1,6 +1,6 @@
if not WeakAuras.IsCorrectVersion() then return end if not WeakAuras.IsCorrectVersion() then return end
local Type, Version = "WeakAurasTextureButton", 23 local Type, Version = "WeakAurasTextureButton", 25
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
@@ -96,7 +96,7 @@ local function Constructor()
tile = true, tileSize = 16, edgeSize = 16, tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 } insets = { left = 4, right = 4, top = 4, bottom = 4 }
}); });
button:SetBackdropColor(0.1,0.1,0.1); button:SetBackdropColor(0.1,0.1,0.1,0.2);
button:SetBackdropBorderColor(0.4,0.4,0.4); button:SetBackdropBorderColor(0.4,0.4,0.4);
local highlighttexture = button:CreateTexture(nil, "OVERLAY"); local highlighttexture = button:CreateTexture(nil, "OVERLAY");
@@ -2,7 +2,7 @@
ToolbarButton Widget, based on AceGUI Button ToolbarButton Widget, based on AceGUI Button
Graphical Button. Graphical Button.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasToolbarButton", 4 local Type, Version = "WeakAurasToolbarButton", 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
@@ -23,10 +23,18 @@ local function Button_OnClick(frame, ...)
end end
local function Control_OnEnter(frame) local function Control_OnEnter(frame)
if frame.tooltip then
GameTooltip:ClearLines()
GameTooltip:SetOwner(frame, "ANCHOR_NONE");
GameTooltip:SetPoint("BOTTOM", frame, "TOP", 0, 5);
GameTooltip:AddLine(frame.tooltip)
GameTooltip:Show()
end
frame.obj:Fire("OnEnter") frame.obj:Fire("OnEnter")
end end
local function Control_OnLeave(frame) local function Control_OnLeave(frame)
GameTooltip:Hide()
frame.obj:Fire("OnLeave") frame.obj:Fire("OnLeave")
end end
@@ -54,6 +62,10 @@ local methods = {
end end
end, end,
["SetTooltip"] = function(self, text)
self.frame.tooltip = text
end,
["SetDisabled"] = function(self, disabled) ["SetDisabled"] = function(self, disabled)
self.disabled = disabled self.disabled = disabled
if disabled then if disabled then
+182 -67
View File
@@ -16,6 +16,7 @@ local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll)
local function filterAnimPresetTypes(intable, id) local function filterAnimPresetTypes(intable, id)
local ret = {}; local ret = {};
OptionsPrivate.Private.EnsureRegion(id)
local region = WeakAuras.regions[id] and WeakAuras.regions[id].region; local region = WeakAuras.regions[id] and WeakAuras.regions[id].region;
local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType; local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType;
local data = WeakAuras.GetData(id); local data = WeakAuras.GetData(id);
@@ -79,7 +80,8 @@ function OptionsPrivate.GetAnimationOptions(data)
data.animation[field] = data.animation[field] or {}; data.animation[field] = data.animation[field] or {};
data.animation[field][value] = v; data.animation[field][value] = v;
if(field == "main") then if(field == "main") then
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); local region = OptionsPrivate.Private.EnsureRegion(id)
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true);
if(WeakAuras.clones[id]) then if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId);
@@ -148,7 +150,9 @@ function OptionsPrivate.GetAnimationOptions(data)
order = 33, order = 33,
values = duration_types_no_choice, values = duration_types_no_choice,
disabled = true, disabled = true,
hidden = function() return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, hidden = function()
return data.animation.start.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data)
end,
get = function() return "seconds" end get = function() return "seconds" end
}, },
start_duration_type = { start_duration_type = {
@@ -157,7 +161,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Time in"], name = L["Time in"],
order = 33, order = 33,
values = duration_types, values = duration_types,
hidden = function() return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end hidden = function()
return data.animation.start.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data)
end
}, },
start_duration = { start_duration = {
type = "input", type = "input",
@@ -275,7 +281,7 @@ function OptionsPrivate.GetAnimationOptions(data)
hidden = function() hidden = function()
return ( return (
data.animation.start.type ~= "custom" data.animation.start.type ~= "custom"
or not WeakAuras.regions[id].region.Scale or not OptionsPrivate.Private.EnsureRegion(id).Scale
) end ) end
}, },
start_scaleType = { start_scaleType = {
@@ -284,7 +290,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 43, order = 43,
values = anim_scale_types, values = anim_scale_types,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
-- texteditor added below -- texteditor added below
start_scalex = { start_scalex = {
@@ -297,7 +305,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
start_scaley = { start_scaley = {
type = "range", type = "range",
@@ -309,14 +319,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
start_use_rotate = { start_use_rotate = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Rotate In"], name = L["Rotate In"],
order = 46, order = 46,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
start_rotateType = { start_rotateType = {
type = "select", type = "select",
@@ -324,7 +338,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 47, order = 47,
values = anim_rotate_types, values = anim_rotate_types,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
-- texteditor added below -- texteditor added below
start_rotate = { start_rotate = {
@@ -336,14 +352,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0, softMin = 0,
softMax = 360, softMax = 360,
bigStep = 3, bigStep = 3,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
start_use_color = { start_use_color = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Color"], name = L["Color"],
order = 48.2, order = 48.2,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
start_colorType = { start_colorType = {
type = "select", type = "select",
@@ -351,7 +371,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 48.5, order = 48.5,
values = anim_color_types, values = anim_color_types,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
-- texteditor added below -- texteditor added below
start_color = { start_color = {
@@ -359,7 +381,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
name = L["Color"], name = L["Color"],
order = 49.5, order = 49.5,
hidden = function() return (data.animation.start.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, hidden = function()
return (data.animation.start.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end,
get = function() get = function()
return data.animation.start.colorR, return data.animation.start.colorR,
data.animation.start.colorG, data.animation.start.colorG,
@@ -401,7 +425,9 @@ function OptionsPrivate.GetAnimationOptions(data)
order = 53, order = 53,
values = duration_types_no_choice, values = duration_types_no_choice,
disabled = true, disabled = true,
hidden = function() return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data) end, hidden = function()
return data.animation.main.type ~= "custom" or OptionsPrivate.Private.CanHaveDuration(data)
end,
get = function() return "seconds" end get = function() return "seconds" end
}, },
main_duration_type = { main_duration_type = {
@@ -410,7 +436,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Time in"], name = L["Time in"],
order = 53, order = 53,
values = duration_types, values = duration_types,
hidden = function() return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data) end hidden = function()
return data.animation.main.type ~= "custom" or not OptionsPrivate.Private.CanHaveDuration(data)
end
}, },
main_duration = { main_duration = {
type = "input", type = "input",
@@ -528,7 +556,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Zoom"], name = L["Zoom"],
order = 62, order = 62,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
main_scaleType = { main_scaleType = {
type = "select", type = "select",
@@ -536,7 +566,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 63, order = 63,
values = anim_scale_types, values = anim_scale_types,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
-- texteditor added below -- texteditor added below
main_scalex = { main_scalex = {
@@ -549,7 +581,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
main_scaley = { main_scaley = {
type = "range", type = "range",
@@ -561,14 +595,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
main_use_rotate = { main_use_rotate = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Rotate"], name = L["Rotate"],
order = 66, order = 66,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
main_rotateType = { main_rotateType = {
type = "select", type = "select",
@@ -576,7 +614,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 67, order = 67,
values = anim_rotate_types, values = anim_rotate_types,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
-- text editor added below -- text editor added below
main_rotate = { main_rotate = {
@@ -588,14 +628,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0, softMin = 0,
softMax = 360, softMax = 360,
bigStep = 3, bigStep = 3,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
main_use_color = { main_use_color = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Color"], name = L["Color"],
order = 68.2, order = 68.2,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
main_colorType = { main_colorType = {
type = "select", type = "select",
@@ -603,7 +647,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 68.5, order = 68.5,
values = anim_color_types, values = anim_color_types,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
-- texteditor added below -- texteditor added below
main_color = { main_color = {
@@ -611,7 +657,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
name = L["Color"], name = L["Color"],
order = 69.5, order = 69.5,
hidden = function() return (data.animation.main.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, hidden = function()
return (data.animation.main.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end,
get = function() get = function()
return data.animation.main.colorR, return data.animation.main.colorR,
data.animation.main.colorG, data.animation.main.colorG,
@@ -757,7 +805,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Zoom Out"], name = L["Zoom Out"],
order = 82, order = 82,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
finish_scaleType = { finish_scaleType = {
type = "select", type = "select",
@@ -765,7 +815,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 83, order = 83,
values = anim_scale_types, values = anim_scale_types,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
-- texteditor added below -- texteditor added below
finish_scalex = { finish_scalex = {
@@ -778,7 +830,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
finish_scaley = { finish_scaley = {
type = "range", type = "range",
@@ -790,14 +844,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5, softMax = 5,
step = 0.01, step = 0.01,
bigStep = 0.1, bigStep = 0.1,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Scale) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Scale)
end
}, },
finish_use_rotate = { finish_use_rotate = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Rotate Out"], name = L["Rotate Out"],
order = 86, order = 86,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
finish_rotateType = { finish_rotateType = {
type = "select", type = "select",
@@ -805,7 +863,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 87, order = 87,
values = anim_rotate_types, values = anim_rotate_types,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
-- texteditor added below -- texteditor added below
finish_rotate = { finish_rotate = {
@@ -817,14 +877,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0, softMin = 0,
softMax = 360, softMax = 360,
bigStep = 3, bigStep = 3,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Rotate) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
end
}, },
finish_use_color = { finish_use_color = {
type = "toggle", type = "toggle",
width = WeakAuras.normalWidth, width = WeakAuras.normalWidth,
name = L["Color"], name = L["Color"],
order = 88.2, order = 88.2,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
finish_colorType = { finish_colorType = {
type = "select", type = "select",
@@ -832,7 +896,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"], name = L["Type"],
order = 88.5, order = 88.5,
values = anim_color_types, values = anim_color_types,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end
}, },
-- texteditor added below -- texteditor added below
finish_color = { finish_color = {
@@ -840,7 +906,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
name = L["Color"], name = L["Color"],
order = 89.5, order = 89.5,
hidden = function() return (data.animation.finish.type ~= "custom" or not WeakAuras.regions[id].region.Color) end, hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Color)
end,
get = function() get = function()
return data.animation.finish.colorR, return data.animation.finish.colorR,
data.animation.finish.colorG, data.animation.finish.colorG,
@@ -858,106 +926,153 @@ function OptionsPrivate.GetAnimationOptions(data)
} }
local function extraSetFunction() local function extraSetFunction()
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[id].region, false, nil, true); OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main,
OptionsPrivate.Private.EnsureRegion(id), false, nil, true)
if(WeakAuras.clones[id]) then if(WeakAuras.clones[id]) then
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main,
cloneRegion, false, nil, true, cloneId)
end end
end end
end end
-- Text Editors for "start" -- Text Editors for "start"
local function hideStartAlphaFunc() local function hideStartAlphaFunc()
return data.animation.start.type ~= "custom" or data.animation.start.alphaType ~= "custom" or not data.animation.start.use_alpha return data.animation.start.type ~= "custom"
or data.animation.start.alphaType ~= "custom"
or not data.animation.start.use_alpha
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_alphaFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false); 35.3, hideStartAlphaFunc, {"animation", "start", "alphaFunc"}, false);
local function hideStartTranslate() local function hideStartTranslate()
return data.animation.start.type ~= "custom" or data.animation.start.translateType ~= "custom" or not data.animation.start.use_translate return data.animation.start.type ~= "custom"
or data.animation.start.translateType ~= "custom"
or not data.animation.start.use_translate
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_translateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false); 39.3, hideStartTranslate, {"animation", "start", "translateFunc"}, false);
local function hideStartScale() local function hideStartScale()
return data.animation.start.type ~= "custom" or data.animation.start.scaleType ~= "custom" or not (data.animation.start.use_scale and WeakAuras.regions[id].region.Scale) return data.animation.start.type ~= "custom"
or data.animation.start.scaleType ~= "custom"
or not (data.animation.start.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_scaleFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false); 43.3, hideStartScale, {"animation", "start", "scaleFunc"}, false);
local function hideStartRotateFunc() local function hideStartRotateFunc()
return data.animation.start.type ~= "custom" or data.animation.start.rotateType ~= "custom" or not (data.animation.start.use_rotate and WeakAuras.regions[id].region.Rotate) return data.animation.start.type ~= "custom"
or data.animation.start.rotateType ~= "custom"
or not (data.animation.start.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_rotateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false); 47.3, hideStartRotateFunc, {"animation", "start", "rotateFunc"}, false);
local function hideStartColorFunc() local function hideStartColorFunc()
return data.animation.start.type ~= "custom" or data.animation.start.colorType ~= "custom" or not (data.animation.start.use_color and WeakAuras.regions[id].region.Color) return data.animation.start.type ~= "custom"
or data.animation.start.colorType ~= "custom"
or not (data.animation.start.use_color and OptionsPrivate.Private.EnsureRegion(id).Color)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "start_colorFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false); 48.7, hideStartColorFunc, {"animation", "start", "colorFunc"}, false);
-- Text Editors for "main" -- Text Editors for "main"
local function hideMainAlphaFunc() local function hideMainAlphaFunc()
return data.animation.main.type ~= "custom" or data.animation.main.alphaType ~= "custom" or not data.animation.main.use_alpha return data.animation.main.type ~= "custom"
or data.animation.main.alphaType ~= "custom"
or not data.animation.main.use_alpha
end end
local mainCodeOptions = { extraSetFunction = extraSetFunction } local mainCodeOptions = { extraSetFunction = extraSetFunction }
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_alphaFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, mainCodeOptions); 55.3, hideMainAlphaFunc, {"animation", "main", "alphaFunc"}, false, mainCodeOptions);
local function hideMainTranslate() local function hideMainTranslate()
return data.animation.main.type ~= "custom" or data.animation.main.translateType ~= "custom" or not data.animation.main.use_translate return data.animation.main.type ~= "custom"
or data.animation.main.translateType ~= "custom"
or not data.animation.main.use_translate
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_translateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, mainCodeOptions); 59.3, hideMainTranslate, {"animation", "main", "translateFunc"}, false, mainCodeOptions);
local function hideMainScale() local function hideMainScale()
return data.animation.main.type ~= "custom" or data.animation.main.scaleType ~= "custom" or not (data.animation.main.use_scale and WeakAuras.regions[id].region.Scale) return data.animation.main.type ~= "custom"
or data.animation.main.scaleType ~= "custom"
or not (data.animation.main.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_scaleFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-sizes",
63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, mainCodeOptions); 63.3, hideMainScale, {"animation", "main", "scaleFunc"}, false, mainCodeOptions);
local function hideMainRotateFunc() local function hideMainRotateFunc()
return data.animation.main.type ~= "custom" or data.animation.main.rotateType ~= "custom" or not (data.animation.main.use_rotate and WeakAuras.regions[id].region.Rotate) return data.animation.main.type ~= "custom"
or data.animation.main.rotateType ~= "custom"
or not (data.animation.main.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_rotateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, mainCodeOptions); 67.3, hideMainRotateFunc, {"animation", "main", "rotateFunc"}, false, mainCodeOptions);
local function hideMainColorFunc() local function hideMainColorFunc()
return data.animation.main.type ~= "custom" or data.animation.main.colorType ~= "custom" or not (data.animation.main.use_color and WeakAuras.regions[id].region.Color) return data.animation.main.type ~= "custom"
or data.animation.main.colorType ~= "custom"
or not (data.animation.main.use_color and OptionsPrivate.Private.EnsureRegion(id).Color)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "main_colorFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, mainCodeOptions); 68.7, hideMainColorFunc, {"animation", "main", "colorFunc"}, false, mainCodeOptions);
-- Text Editors for "finish" -- Text Editors for "finish"
local function hideFinishAlphaFunc() local function hideFinishAlphaFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.alphaType ~= "custom" or not data.animation.finish.use_alpha return data.animation.finish.type ~= "custom"
or data.animation.finish.alphaType ~= "custom"
or not data.animation.finish.use_alpha
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_alphaFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#alpha-opacity",
75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false); 75.3, hideFinishAlphaFunc, {"animation", "finish", "alphaFunc"}, false);
local function hideFinishTranslate() local function hideFinishTranslate()
return data.animation.finish.type ~= "custom" or data.animation.finish.translateType ~= "custom" or not data.animation.finish.use_translate return data.animation.finish.type ~= "custom"
or data.animation.finish.translateType ~= "custom"
or not data.animation.finish.use_translate
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_translateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#translate-position",
79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false); 79.3, hideFinishTranslate, {"animation", "finish", "translateFunc"}, false);
local function hideFinishScale() local function hideFinishScale()
return data.animation.finish.type ~= "custom" or data.animation.finish.scaleType ~= "custom" or not (data.animation.finish.use_scale and WeakAuras.regions[id].region.Scale) return data.animation.finish.type ~= "custom"
or data.animation.finish.scaleType ~= "custom"
or not (data.animation.finish.use_scale and OptionsPrivate.Private.EnsureRegion(id).Scale)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_scaleFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#scale-size",
83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false); 83.3, hideFinishScale, {"animation", "finish", "scaleFunc"}, false);
local function hideFinishRotateFunc() local function hideFinishRotateFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.rotateType ~= "custom" or not (data.animation.finish.use_rotate and WeakAuras.regions[id].region.Rotate) return data.animation.finish.type ~= "custom"
or data.animation.finish.rotateType ~= "custom"
or not (data.animation.finish.use_rotate and OptionsPrivate.Private.EnsureRegion(id).Rotate)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_rotateFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#rotate",
87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false); 87.3, hideFinishRotateFunc, {"animation", "finish", "rotateFunc"}, false);
local function hideFinishColorFunc() local function hideFinishColorFunc()
return data.animation.finish.type ~= "custom" or data.animation.finish.colorType ~= "custom" or not (data.animation.finish.use_color and WeakAuras.regions[id].region.Color) return data.animation.finish.type ~= "custom"
or data.animation.finish.colorType ~= "custom"
or not (data.animation.finish.use_color and OptionsPrivate.Private.EnsureRegion(id).Color)
end end
OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc", "https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color", OptionsPrivate.commonOptions.AddCodeOption(animation.args, data, L["Custom Function"], "finish_colorFunc",
"https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Code-Blocks#color",
88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false); 88.7, hideFinishColorFunc, {"animation", "finish", "colorFunc"}, false);
if(data.controlledChildren) then if(data.controlledChildren) then
+2 -2
View File
@@ -936,7 +936,7 @@ end
local function CreateSetAll(subOption, getAll) local function CreateSetAll(subOption, getAll)
return function(data, info, ...) return function(data, info, ...)
OptionsPrivate.Private.pauseOptionsProcessing(true); OptionsPrivate.Private.pauseOptionsProcessing(true);
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
local before = getAll(data, info, ...) local before = getAll(data, info, ...)
for child in OptionsPrivate.Private.TraverseLeafs(data) do for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption) local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
@@ -974,7 +974,7 @@ local function CreateSetAll(subOption, getAll)
end end
end end
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.Private.pauseOptionsProcessing(false); OptionsPrivate.Private.pauseOptionsProcessing(false);
OptionsPrivate.Private.ScanForLoads(); OptionsPrivate.Private.ScanForLoads();
OptionsPrivate.SortDisplayButtons(nil, true); OptionsPrivate.SortDisplayButtons(nil, true);
+21 -2
View File
@@ -44,7 +44,7 @@ local function GetCustomTriggerOptions(data, triggernum)
check = { check = {
type = "select", type = "select",
name = L["Check On..."], name = L["Check On..."],
width = WeakAuras.doubleWidth / 3, width = WeakAuras.doubleWidth,
order = 8, order = 8,
values = OptionsPrivate.Private.check_types, values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom" hidden = function() return not (trigger.type == "custom"
@@ -75,7 +75,9 @@ local function GetCustomTriggerOptions(data, triggernum)
}, },
events = { events = {
type = "input", type = "input",
width = WeakAuras.doubleWidth * 2 / 3, multiline = true,
control = "WeakAuras-MultiLineEditBoxWithEnter",
width = WeakAuras.doubleWidth,
name = L["Event(s)"], name = L["Event(s)"],
desc = L["Custom trigger status tooltip"], desc = L["Custom trigger status tooltip"],
order = 8.1, order = 8.1,
@@ -90,6 +92,8 @@ local function GetCustomTriggerOptions(data, triggernum)
}, },
events2 = { events2 = {
type = "input", type = "input",
multiline = true,
control = "WeakAuras-MultiLineEditBoxWithEnter",
name = L["Event(s)"], name = L["Event(s)"],
desc = L["Custom trigger event tooltip"], desc = L["Custom trigger event tooltip"],
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
@@ -105,6 +109,7 @@ local function GetCustomTriggerOptions(data, triggernum)
type = "description", type = "description",
name = function() name = function()
local events = trigger.custom_type == "event" and trigger.events2 or trigger.events local events = trigger.custom_type == "event" and trigger.events2 or trigger.events
-- Check for errors
for index, event in pairs(WeakAuras.split(events)) do for index, event in pairs(WeakAuras.split(events)) do
local trueEvent local trueEvent
for i in event:gmatch("[^:]+") do for i in event:gmatch("[^:]+") do
@@ -132,6 +137,13 @@ local function GetCustomTriggerOptions(data, triggernum)
end end
end end
end end
-- Check for warnings
for _, event in pairs(WeakAuras.split(events)) do
if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then
return "|cFFFF0000"..L["COMBAT_LOG_EVENT_UNFILTERED with no filter can trigger frame drops in raid environment."]
end
end
return "" return ""
end, end,
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
@@ -146,6 +158,7 @@ local function GetCustomTriggerOptions(data, triggernum)
return true return true
end end
local events = trigger.custom_type == "event" and trigger.events2 or trigger.events local events = trigger.custom_type == "event" and trigger.events2 or trigger.events
-- Check for errors
for index, event in pairs(WeakAuras.split(events)) do for index, event in pairs(WeakAuras.split(events)) do
local trueEvent local trueEvent
for i in event:gmatch("[^:]+") do for i in event:gmatch("[^:]+") do
@@ -172,6 +185,12 @@ local function GetCustomTriggerOptions(data, triggernum)
end end
end end
end end
-- Check for warnings
for _, event in pairs(WeakAuras.split(events)) do
if event == "CLEU" or event == "COMBAT_LOG_EVENT_UNFILTERED" then
return false
end
end
return true return true
end end
}, },
@@ -58,17 +58,11 @@ local colorScheme = {
local function ConstructCodeReview(frame) local function ConstructCodeReview(frame)
local group = AceGUI:Create("WeakAurasInlineGroup"); local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:Hide(); group.frame:Hide();
group:SetLayout("flow"); 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"); local codeTree = AceGUI:Create("TreeGroup");
codeTree:SetTreeWidth(300, false) codeTree:SetTreeWidth(300, false)
codeTree:SetFullWidth(true) codeTree:SetFullWidth(true)
+9 -11
View File
@@ -20,7 +20,7 @@ local spellCache = WeakAuras.spellCache
local function ConstructIconPicker(frame) local function ConstructIconPicker(frame)
local group = AceGUI:Create("InlineGroup"); local group = AceGUI:Create("InlineGroup");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 30); -- 12 group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50);
group.frame:Hide(); group.frame:Hide();
group:SetLayout("fill"); group:SetLayout("fill");
@@ -95,23 +95,21 @@ local function ConstructIconPicker(frame)
end end
end end
local input = CreateFrame("EDITBOX", "WeakAurasIconFilterInput", group.frame, "InputBoxTemplate"); local input = CreateFrame("Editbox", "WeakAurasIconFilterInput", group.frame, "WA_InputBoxTemplate");
input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end); input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end);
input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end); input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end);
input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end); input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end);
input:SetWidth(170); input:SetWidth(200);
input:SetHeight(15); input:SetHeight(15);
input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -12, -5); input:SetFont(STANDARD_TEXT_FONT, 10)
input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, -10);
local inputLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormal");
inputLabel:SetText(L["Search"]);
inputLabel:SetJustifyH("RIGHT");
inputLabel:SetPoint("BOTTOMLEFT", input, "TOPLEFT", 0, 5);
local icon = AceGUI:Create("WeakAurasIconButton"); local icon = AceGUI:Create("WeakAurasIconButton");
icon.frame:Disable(); icon.frame:Disable();
icon.frame:SetParent(group.frame); icon.frame:SetParent(group.frame);
icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 15, -15); icon.frame:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", 44, -15);
icon:SetHeight(36)
icon:SetWidth(36)
local iconLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge"); local iconLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge");
iconLabel:SetNonSpaceWrap("true"); iconLabel:SetNonSpaceWrap("true");
@@ -194,7 +192,7 @@ local function ConstructIconPicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
cancel:SetScript("OnClick", group.CancelClose); cancel:SetScript("OnClick", group.CancelClose);
cancel:SetPoint("bottomright", frame, "bottomright", -27, 11); cancel:SetPoint("BOTTOMRIGHT", -20, -24)
cancel:SetHeight(20); cancel:SetHeight(20);
cancel:SetWidth(100); cancel:SetWidth(100);
cancel:SetText(L["Cancel"]); cancel:SetText(L["Cancel"]);
@@ -17,16 +17,11 @@ local importexport
local function ConstructImportExport(frame) local function ConstructImportExport(frame)
local group = AceGUI:Create("WeakAurasInlineGroup"); local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide(); group.frame:Hide();
group:SetLayout("flow"); group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
group:AddChild(title)
local input = AceGUI:Create("MultiLineEditBox"); local input = AceGUI:Create("MultiLineEditBox");
input:DisableButton(true) input:DisableButton(true)
input:SetFullWidth(true) input:SetFullWidth(true)
@@ -52,7 +47,7 @@ local function ConstructImportExport(frame)
frame.window = "importexport"; frame.window = "importexport";
frame:UpdateFrameVisible() frame:UpdateFrameVisible()
if(mode == "export" or mode == "table") then if(mode == "export" or mode == "table") then
title:SetText(L["Exporting"]) OptionsPrivate.SetTitle(L["Exporting"])
if(id) then if(id) then
local displayStr; local displayStr;
if(mode == "export") then if(mode == "export") then
@@ -71,7 +66,7 @@ local function ConstructImportExport(frame)
input:SetFocus(); input:SetFocus();
end end
elseif(mode == "import") then elseif(mode == "import") then
title:SetText(L["Importing"]) OptionsPrivate.SetTitle(L["Importing"])
input.editBox:SetScript("OnTextChanged", function(self) input.editBox:SetScript("OnTextChanged", function(self)
local pasted = self:GetText() local pasted = self:GetText()
pasted = pasted:match("^%s*(.-)%s*$") pasted = pasted:match("^%s*(.-)%s*$")
@@ -2,7 +2,7 @@ if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ... local AddonName, OptionsPrivate = ...
-- Lua APIs -- Lua APIs
local pairs, rad = pairs, rad local rad = rad
-- WoW APIs -- WoW APIs
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
@@ -50,14 +50,14 @@ local function ConstructModelPicker(frame)
end end
end end
local group = AceGUI:Create("InlineGroup"); local group = AceGUI:Create("SimpleGroup");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -15); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:Hide(); group.frame:Hide();
group:SetLayout("flow"); group:SetLayout("flow");
local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "InputBoxTemplate") local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "WA_InputBoxTemplate")
filterInput:SetAutoFocus(false) filterInput:SetAutoFocus(false)
filterInput:SetTextInsets(16, 20, 0, 0) filterInput:SetTextInsets(16, 20, 0, 0)
@@ -123,8 +123,7 @@ local function ConstructModelPicker(frame)
group.modelTree:RefreshTree() group.modelTree:RefreshTree()
end) end)
filterInput:SetHeight(15) filterInput:SetHeight(15)
filterInput:SetPoint("TOP", group.frame, "TOP", 0, 1) filterInput:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, 5)
filterInput:SetPoint("LEFT", group.frame, "LEFT", 7, 0)
filterInput:SetWidth(200) filterInput:SetWidth(200)
filterInput:SetFont(STANDARD_TEXT_FONT, 10) filterInput:SetFont(STANDARD_TEXT_FONT, 10)
group.frame.filterInput = filterInput group.frame.filterInput = filterInput
@@ -355,7 +354,7 @@ local function ConstructModelPicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate"); local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
cancel:SetScript("OnClick", group.CancelClose); cancel:SetScript("OnClick", group.CancelClose);
cancel:SetPoint("bottomright", frame, "bottomright", -27, 16); cancel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -27, 20);
cancel:SetHeight(20); cancel:SetHeight(20);
cancel:SetWidth(100); cancel:SetWidth(100);
cancel:SetText(L["Cancel"]); cancel:SetText(L["Cancel"]);
@@ -383,7 +383,7 @@ local function BuildAlignLines(mover)
end end
for k, v in pairs(WeakAuras.displayButtons) do for k, v in pairs(WeakAuras.displayButtons) do
local region = v.view.region local region = WeakAuras.GetRegion(v.data.id)
if not skipIds[k] and v.view.visibility ~= 0 and region then if not skipIds[k] and v.view.visibility ~= 0 and region then
local scale = region:GetEffectiveScale() / UIParent:GetEffectiveScale() local scale = region:GetEffectiveScale() / UIParent:GetEffectiveScale()
if not IsControlKeyDown() then if not IsControlKeyDown() then
@@ -652,7 +652,8 @@ local function ConstructMoverSizer(parent)
end end
OptionsPrivate.Private.AddParents(data) OptionsPrivate.Private.AddParents(data)
WeakAuras.FillOptions() WeakAuras.FillOptions()
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true) OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main,
OptionsPrivate.Private.EnsureRegion(data.id), false, nil, true)
-- hide alignment lines -- hide alignment lines
frame.lineY:Hide() frame.lineY:Hide()
frame.lineX:Hide() frame.lineX:Hide()
@@ -776,7 +777,8 @@ local function ConstructMoverSizer(parent)
frame.text:Hide() frame.text:Hide()
frame:SetScript("OnUpdate", nil) frame:SetScript("OnUpdate", nil)
WeakAuras.FillOptions() WeakAuras.FillOptions()
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true) OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main,
OptionsPrivate.Private.EnsureRegion(data.id), false, nil, true)
-- hide alignment lines -- hide alignment lines
frame.lineY:Hide() frame.lineY:Hide()
frame.lineX:Hide() frame.lineX:Hide()
+220 -274
View File
@@ -11,8 +11,8 @@ local GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsA
= GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsAddOnLoaded, LoadAddOn, UnitName = GetScreenWidth, GetScreenHeight, CreateFrame, GetAddOnInfo, PlaySound, IsAddOnLoaded, LoadAddOn, UnitName
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local WeakAuras = WeakAuras local WeakAuras = WeakAuras
local L = WeakAuras.L local L = WeakAuras.L
@@ -22,71 +22,26 @@ local regionOptions = WeakAuras.regionOptions
local tempGroup = OptionsPrivate.tempGroup local tempGroup = OptionsPrivate.tempGroup
local aceOptions = {} local aceOptions = {}
local function CreateDecoration(frame)
local deco = CreateFrame("Frame", nil, frame)
deco:SetSize(17, 40)
local bg1 = deco:CreateTexture(nil, "BACKGROUND")
bg1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg1:SetTexCoord(0.31, 0.67, 0, 0.63)
bg1:SetAllPoints(deco)
local bg2 = deco:CreateTexture(nil, "BACKGROUND")
bg2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg2:SetTexCoord(0.235, 0.275, 0, 0.63)
bg2:SetPoint("RIGHT", bg1, "LEFT")
bg2:SetSize(10, 40)
local bg3 = deco:CreateTexture(nil, "BACKGROUND")
bg3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
bg3:SetTexCoord(0.72, 0.76, 0, 0.63)
bg3:SetPoint("LEFT", bg1, "RIGHT")
bg3:SetSize(10, 40)
return deco
end
local function CreateDecorationWide(frame, width)
local deco1 = frame:CreateTexture(nil, "OVERLAY")
deco1:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco1:SetTexCoord(0.31, 0.67, 0, 0.63)
deco1:SetSize(width, 40)
local deco2 = frame:CreateTexture(nil, "OVERLAY")
deco2:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco2:SetTexCoord(0.21, 0.31, 0, 0.63)
deco2:SetPoint("RIGHT", deco1, "LEFT")
deco2:SetSize(30, 40)
local deco3 = frame:CreateTexture(nil, "OVERLAY")
deco3:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
deco3:SetTexCoord(0.67, 0.77, 0, 0.63)
deco3:SetPoint("LEFT", deco1, "RIGHT")
deco3:SetSize(30, 40)
return deco1
end
local function CreateFrameSizer(frame, callback, position) local function CreateFrameSizer(frame, callback, position)
callback = callback or (function() end) callback = callback or (function() end)
local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2 local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2
if position == "BOTTOMLEFT" then if position == "BOTTOMLEFT" then
left, right, top, bottom = 1, 0, 0, 1 left, right, top, bottom = 1, 0, 0, 1
xOffset1, yOffset1 = 6, 6 xOffset1, yOffset1 = 1, 1
xOffset2, yOffset2 = 0, 0 xOffset2, yOffset2 = 0, 0
elseif position == "BOTTOMRIGHT" then elseif position == "BOTTOMRIGHT" then
left, right, top, bottom = 0, 1, 0, 1 left, right, top, bottom = 0, 1, 0, 1
xOffset1, yOffset1 = 0, 6 xOffset1, yOffset1 = 0, 1
xOffset2, yOffset2 = -6, 0 xOffset2, yOffset2 = -1, 0
elseif position == "TOPLEFT" then elseif position == "TOPLEFT" then
left, right, top, bottom = 1, 0, 1, 0 left, right, top, bottom = 1, 0, 1, 0
xOffset1, yOffset1 = 6, 0 xOffset1, yOffset1 = 1, 0
xOffset2, yOffset2 = 0, -6 xOffset2, yOffset2 = 0, -1
elseif position == "TOPRIGHT" then elseif position == "TOPRIGHT" then
left, right, top, bottom = 0, 1, 1, 0 left, right, top, bottom = 0, 1, 1, 0
xOffset1, yOffset1 = 0, 0 xOffset1, yOffset1 = 0, 0
xOffset2, yOffset2 = -6, -6 xOffset2, yOffset2 = -1, -1
end end
local handle = CreateFrame("BUTTON", nil, frame) local handle = CreateFrame("BUTTON", nil, frame)
@@ -133,45 +88,52 @@ local minWidth = 750
local minHeight = 240 local minHeight = 240
function OptionsPrivate.CreateFrame() function OptionsPrivate.CreateFrame()
local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate") CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
local frame local frame
local db = OptionsPrivate.savedVars.db local db = OptionsPrivate.savedVars.db
local odb = OptionsPrivate.savedVars.odb local odb = OptionsPrivate.savedVars.odb
-------- Mostly Copied from AceGUIContainer-Frame--------
frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent) frame = CreateFrame("Frame", "WeakAurasOptions", UIParent, "WA_PortraitFrameTemplate")
function OptionsPrivate.SetTitle(title)
local text = "WeakAuras " .. WeakAuras.versionString
if title and title ~= "" then
text = ("%s - %s"):format(text, title)
end
WeakAurasOptionsTitleText:SetText(text)
end
tinsert(UISpecialFrames, frame:GetName()) tinsert(UISpecialFrames, frame:GetName())
frame:SetBackdrop({
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.1, 0.1, 0.1, 0.85)
frame:EnableMouse(true) frame:EnableMouse(true)
frame:SetMovable(true) frame:SetMovable(true)
frame:SetResizable(true) frame:SetResizable(true)
frame:SetMinResize(minWidth, minHeight) frame:SetMinResize(minWidth, minHeight)
frame:SetFrameStrata("DIALOG") frame:SetFrameStrata("DIALOG")
frame.PortraitContainer.portrait:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\logo_256_round.tga]])
frame.window = "default" frame.window = "default"
local xOffset, yOffset local xOffset, yOffset
if db.frame then if db.frame then
xOffset, yOffset = db.frame.xOffset, db.frame.yOffset -- Convert from old settings to new
odb.frame = db.frame
if odb.frame.xOffset and odb.frame.yOffset then
odb.frame.xOffset = odb.frame.xOffset + GetScreenWidth() - (odb.frame.width or defaultWidth) / 2
odb.frame.yOffset = odb.frame.yOffset + GetScreenHeight()
end
db.frame = nil
end end
if not (xOffset and yOffset) then if not (xOffset and yOffset) then
xOffset = (defaultWidth - GetScreenWidth()) / 2 xOffset = GetScreenWidth() / 2
yOffset = (defaultHeight - GetScreenHeight()) / 2 yOffset = GetScreenHeight() - defaultHeight / 2
end end
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset) frame:SetPoint("TOP", UIParent, "BOTTOMLEFT", xOffset, yOffset)
frame:Hide() frame:Hide()
frame:SetScript("OnHide", function() frame:SetScript("OnHide", function()
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
OptionsPrivate.Private.ClearFakeStates() OptionsPrivate.Private.ClearFakeStates()
@@ -187,7 +149,7 @@ function OptionsPrivate.CreateFrame()
end end
end end
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.Private.Resume() OptionsPrivate.Private.Resume()
if OptionsPrivate.Private.mouseFrame then if OptionsPrivate.Private.mouseFrame then
@@ -201,8 +163,8 @@ function OptionsPrivate.CreateFrame()
local width, height local width, height
if db.frame then if odb.frame then
width, height = db.frame.width, db.frame.height width, height = odb.frame.width, odb.frame.height
end end
if not (width and height) then if not (width and height) then
@@ -214,65 +176,34 @@ function OptionsPrivate.CreateFrame()
frame:SetWidth(width) frame:SetWidth(width)
frame:SetHeight(height) frame:SetHeight(height)
local close = CreateDecoration(frame) OptionsPrivate.SetTitle()
close:SetPoint("TOPRIGHT", -30, 12)
local closebutton = CreateFrame("BUTTON", nil, close, "UIPanelCloseButton")
closebutton:SetPoint("CENTER", close, "CENTER", 1, -1)
closebutton:SetScript("OnClick", WeakAuras.HideOptions)
local title = CreateFrame("Frame", nil, frame)
local titleText = title:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titleText:SetText("WeakAuras " .. WeakAuras.versionString)
local titleBG = CreateDecorationWide(frame, max(120, titleText:GetWidth()))
titleBG:SetPoint("TOP", 0, 24)
titleText:SetPoint("TOP", titleBG, "TOP", 0, -14)
local function commitWindowChanges() local function commitWindowChanges()
local xOffset = frame:GetRight() - GetScreenWidth()
local yOffset = frame:GetTop() - GetScreenHeight()
if title:GetRight() > GetScreenWidth() then
xOffset = xOffset + (GetScreenWidth() - title:GetRight())
elseif title:GetLeft() < 0 then
xOffset = xOffset + (0 - title:GetLeft())
end
if title:GetTop() > GetScreenHeight() then
yOffset = yOffset + (GetScreenHeight() - title:GetTop())
elseif title:GetBottom() < 0 then
yOffset = yOffset + (0 - title:GetBottom())
end
db.frame = db.frame or {}
db.frame.xOffset = xOffset
db.frame.yOffset = yOffset
if not frame.minimized then if not frame.minimized then
db.frame.width = frame:GetWidth() local xOffset = frame:GetRight()-(frame:GetWidth()/2)
db.frame.height = frame:GetHeight() local yOffset = frame:GetTop()
odb.frame = odb.frame or {}
odb.frame.xOffset = xOffset
odb.frame.yOffset = yOffset
odb.frame.width = frame:GetWidth()
odb.frame.height = frame:GetHeight()
end end
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset)
end end
title:EnableMouse(true) frame:SetScript("OnMouseDown", function()
title:SetScript("OnMouseDown", function() frame:StartMoving() end) frame:StartMoving()
title:SetScript("OnMouseUp", function() end)
frame:SetScript("OnMouseUp", function()
frame:StopMovingOrSizing() frame:StopMovingOrSizing()
commitWindowChanges() commitWindowChanges()
end) end)
title:SetPoint("BOTTOMLEFT", titleBG, "BOTTOMLEFT", -25, 0)
title:SetPoint("TOPRIGHT", titleBG, "TOPRIGHT", 25, 0)
frame.bottomLeftResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMLEFT")
frame.bottomRightResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT") frame.bottomRightResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT")
local minimize = CreateDecoration(frame)
minimize:SetPoint("TOPRIGHT", -65, 12)
frame.UpdateFrameVisible = function(self) frame.UpdateFrameVisible = function(self)
self.tipPopup:Hide()
if self.minimized then if self.minimized then
WeakAurasOptionsTitleText:Hide()
self.buttonsContainer.frame:Hide() self.buttonsContainer.frame:Hide()
self.texturePicker.frame:Hide() self.texturePicker.frame:Hide()
self.iconPicker.frame:Hide() self.iconPicker.frame:Hide()
@@ -287,64 +218,68 @@ function OptionsPrivate.CreateFrame()
self.container.frame:Hide() self.container.frame:Hide()
self.loadProgress:Hide() self.loadProgress:Hide()
self.toolbarContainer.frame:Hide() self.toolbarContainer:Hide()
self.filterInput:Hide(); self.filterInput:Hide();
self.tipFrame.frame:Hide() self.tipFrame:Hide()
self.bottomLeftResizer:Hide() self:HideTip()
self.bottomRightResizer:Hide() self.bottomRightResizer:Hide()
else else
self.bottomLeftResizer:Show() WeakAurasOptionsTitleText:Show()
self.bottomRightResizer:Show() self.bottomRightResizer:Show()
if self.window == "default" then if self.window == "default" then
OptionsPrivate.SetTitle()
self.buttonsContainer.frame:Show() self.buttonsContainer.frame:Show()
self.container.frame:Show() self.container.frame:Show()
if self.tipFrameIsVisible then self:ShowTip()
self.tipFrame.frame:Show()
else
self.tipFrame.frame:Hide()
end
else else
self.buttonsContainer.frame:Hide() self.buttonsContainer.frame:Hide()
self.container.frame:Hide() self.container.frame:Hide()
self.tipFrame.frame:Hide() self:HideTip()
end end
if self.window == "texture" then if self.window == "texture" then
OptionsPrivate.SetTitle(L["Texture Picker"])
self.texturePicker.frame:Show() self.texturePicker.frame:Show()
else else
self.texturePicker.frame:Hide() self.texturePicker.frame:Hide()
end end
if self.window == "icon" then if self.window == "icon" then
OptionsPrivate.SetTitle(L["Icon Picker"])
self.iconPicker.frame:Show() self.iconPicker.frame:Show()
else else
self.iconPicker.frame:Hide() self.iconPicker.frame:Hide()
end end
if self.window == "model" then if self.window == "model" then
OptionsPrivate.SetTitle(L["Model Picker"])
self.modelPicker.frame:Show() self.modelPicker.frame:Show()
else else
self.modelPicker.frame:Hide() self.modelPicker.frame:Hide()
end end
if self.window == "importexport" then if self.window == "importexport" then
OptionsPrivate.SetTitle(L["Import / Export"])
self.importexport.frame:Show() self.importexport.frame:Show()
else else
self.importexport.frame:Hide() self.importexport.frame:Hide()
end end
if self.window == "texteditor" then if self.window == "texteditor" then
OptionsPrivate.SetTitle(L["Code Editor"])
self.texteditor.frame:Show() self.texteditor.frame:Show()
else else
self.texteditor.frame:Hide() self.texteditor.frame:Hide()
end end
if self.window == "codereview" then if self.window == "codereview" then
OptionsPrivate.SetTitle(L["Custom Code Viewer"])
self.codereview.frame:Show() self.codereview.frame:Show()
else else
self.codereview.frame:Hide() self.codereview.frame:Hide()
end end
if self.window == "newView" then if self.window == "newView" then
OptionsPrivate.SetTitle(L["New Template"])
self.newView.frame:Show() self.newView.frame:Show()
else else
if self.newView then if self.newView then
@@ -352,6 +287,7 @@ function OptionsPrivate.CreateFrame()
end end
end end
if self.window == "update" then if self.window == "update" then
OptionsPrivate.SetTitle(L["Update"])
self.update.frame:Show() self.update.frame:Show()
else else
self.update.frame:Hide() self.update.frame:Hide()
@@ -359,60 +295,52 @@ function OptionsPrivate.CreateFrame()
if self.window == "default" then if self.window == "default" then
if self.loadProgessVisible then if self.loadProgessVisible then
self.loadProgress:Show() self.loadProgress:Show()
self.toolbarContainer.frame:Hide() self.toolbarContainer:Hide()
self.filterInput:Hide(); self.filterInput:Hide();
else else
self.loadProgress:Hide() self.loadProgress:Hide()
self.toolbarContainer.frame:Show() self.toolbarContainer:Show()
self.filterInput:Show(); self.filterInput:Show();
--self.filterInputClear:Show(); --self.filterInputClear:Show();
end end
else else
self.loadProgress:Hide() self.loadProgress:Hide()
self.toolbarContainer.frame:Hide() self.toolbarContainer:Hide()
self.filterInput:Hide(); self.filterInput:Hide();
end end
end end
end end
local minimizebutton = CreateFrame("BUTTON", nil, minimize) local minimizebutton = CreateFrame("Button", nil, frame, "WA_MaximizeMinimizeButtonFrameTemplate")
minimizebutton:SetWidth(30) minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0)
minimizebutton:SetHeight(30) minimizebutton:SetOnMaximizedCallback(function()
minimizebutton:SetPoint("CENTER", minimize, "CENTER", 1, -1) frame.minimized = false
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp") local right, top = frame:GetRight(), frame:GetTop()
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp") frame:ClearAllPoints()
minimizebutton:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp") frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
minimizebutton:SetScript("OnClick", function() frame:SetHeight(odb.frame and odb.frame.height or defaultHeight)
if frame.minimized then frame:SetWidth(odb.frame and odb.frame.width or defaultWidth)
frame.minimized = nil frame.buttonsScroll:DoLayout()
if db.frame then frame:UpdateFrameVisible()
if not db.frame.height or db.frame.height < 240 then end)
db.frame.height = 500 minimizebutton:SetOnMinimizedCallback(function()
end commitWindowChanges()
end frame.minimized = true
frame:SetHeight(db.frame and db.frame.height or 500) local right, top = frame:GetRight(), frame:GetTop()
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp") frame:ClearAllPoints()
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp") frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
frame:SetHeight(75)
frame.buttonsScroll:DoLayout() frame:SetWidth(160)
else
frame.minimized = true
frame:SetHeight(40)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-ExpandButton-Down.blp")
end
frame:UpdateFrameVisible() frame:UpdateFrameVisible()
end) end)
local tipFrame = AceGUI:Create("SimpleGroup") local tipFrame = CreateFrame("Frame", nil, frame)
tipFrame.frame:SetParent(frame) tipFrame:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 17, 30)
tipFrame:SetLayout("Flow") tipFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
tipFrame.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 22, 15) tipFrame:Hide()
tipFrame.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 15)
tipFrame.frame:Hide()
frame.tipFrame = tipFrame frame.tipFrame = tipFrame
local tipPopup = CreateFrame("Frame", nil, frame) local tipPopup = CreateFrame("Frame", "WeakAuras_TipPopup", frame)
tipPopup:SetFrameStrata("FULLSCREEN") tipPopup:SetFrameStrata("FULLSCREEN")
tipPopup:SetBackdrop({ tipPopup:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
@@ -425,6 +353,7 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetBackdropColor(0, 0, 0, 0.8) tipPopup:SetBackdropColor(0, 0, 0, 0.8)
--tipPopup:SetHeight(100) --tipPopup:SetHeight(100)
tipPopup:Hide() tipPopup:Hide()
frame.tipPopup = tipPopup
local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge") local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge")
tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10) tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10)
@@ -438,7 +367,7 @@ function OptionsPrivate.CreateFrame()
tipPopupLabel:SetJustifyH("LEFT") tipPopupLabel:SetJustifyH("LEFT")
tipPopupLabel:SetJustifyV("TOP") tipPopupLabel:SetJustifyV("TOP")
local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "InputBoxTemplate") local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "WA_InputBoxTemplate")
urlWidget:SetFont(STANDARD_TEXT_FONT, 12) urlWidget:SetFont(STANDARD_TEXT_FONT, 12)
urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0) urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0)
urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0) urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0)
@@ -454,7 +383,7 @@ function OptionsPrivate.CreateFrame()
tipPopupCtrlC:SetJustifyV("TOP") tipPopupCtrlC:SetJustifyV("TOP")
tipPopupCtrlC:SetText(L["Press Ctrl+C to copy the URL"]) tipPopupCtrlC:SetText(L["Press Ctrl+C to copy the URL"])
local function ToggleTip(referenceWidget, url, title, description) local function ToggleTip(referenceWidget, url, title, description, rightAligned)
if tipPopup:IsVisible() and urlWidget.text == url then if tipPopup:IsVisible() and urlWidget.text == url then
tipPopup:Hide() tipPopup:Hide()
return return
@@ -468,60 +397,71 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetWidth(400) tipPopup:SetWidth(400)
tipPopup:SetHeight(26 + tipPopupTitle:GetHeight() + tipPopupLabel:GetHeight() + urlWidget:GetHeight() + tipPopupCtrlC:GetHeight()) tipPopup:SetHeight(26 + tipPopupTitle:GetHeight() + tipPopupLabel:GetHeight() + urlWidget:GetHeight() + tipPopupCtrlC:GetHeight())
tipPopup:SetPoint("BOTTOMLEFT", referenceWidget.frame, "TOPLEFT", -6, 4) tipPopup:ClearAllPoints();
if rightAligned then
tipPopup:SetPoint("BOTTOMRIGHT", referenceWidget, "TOPRIGHT", 6, 4)
else
tipPopup:SetPoint("BOTTOMLEFT", referenceWidget, "TOPLEFT", -6, 4)
end
tipPopup:Show() tipPopup:Show()
end end
OptionsPrivate.ToggleTip = ToggleTip
local addFooter = function(title, texture, url, description) local addFooter = function(title, texture, url, description, rightAligned)
local button = AceGUI:Create("WeakAurasToolbarButton") local button = AceGUI:Create("WeakAurasToolbarButton")
button:SetText(title) button:SetText(title)
button:SetTexture(texture) button:SetTexture(texture)
button:SetCallback("OnClick", function() button:SetCallback("OnClick", function()
ToggleTip(button, url, title, description) ToggleTip(button.frame, url, title, description, rightAligned)
end) end)
tipFrame:AddChild(button) button.frame:Show()
return button.frame
end end
addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt", local discordButton = addFooter(L["Join Discord"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/UXSc7nt",
L["Chat with WeakAuras experts on our Discord server."]) L["Chat with WeakAuras experts on our Discord server."])
discordButton:SetParent(tipFrame)
discordButton:SetPoint("LEFT", tipFrame, "LEFT")
addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki", local documentationButton = addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki",
L["Check out our wiki for a large collection of examples and snippets."]) L["Check out our wiki for a large collection of examples and snippets."])
documentationButton:SetParent(tipFrame)
documentationButton:SetPoint("LEFT", discordButton, "RIGHT", 10, 0)
local awesomeWotlkButton
if not WeakAuras.isAwesomeEnabled() then if not WeakAuras.isAwesomeEnabled() then
addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk", awesomeWotlkButton = addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk",
L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"]) L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"])
awesomeWotlkButton:SetParent(tipFrame)
awesomeWotlkButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0)
end end
addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io", local reportbugButton = addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
L["Browse Wago, the largest collection of auras."]) L["Report bugs on our issue tracker."], true)
reportbugButton:SetParent(tipFrame)
reportbugButton:SetPoint("RIGHT", tipFrame, "RIGHT")
local wagoButton = addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wago.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."], true)
wagoButton:SetParent(tipFrame)
wagoButton:SetPoint("RIGHT", reportbugButton, "LEFT", -10, 0)
local companionButton
if not OptionsPrivate.Private.CompanionData.slugs then if not OptionsPrivate.Private.CompanionData.slugs then
addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf", companionButton = 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."]) L["Keep your Wago imports up to date with the Companion App."])
companionButton:SetParent(tipFrame)
companionButton:SetPoint("RIGHT", wagoButton, "LEFT", -10, 0)
end end
addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/Bunny67/WeakAuras-WotLK/issues/new?assignees=&labels=bug&template=bug_report.md&title=",
L["Report bugs on our issue tracker."])
-- Disable for now
--local closeTipButton = CreateFrame("Button", nil, tipFrame.frame, "UIPanelCloseButton")
--closeTipButton:SetScript("OnClick", function()
-- frame:HideTip()
--end)
--closeTipButton:SetPoint("TOPRIGHT", tipFrame.frame, "TOPRIGHT", 0, 6)
--closeTipButton:Show()
frame.ShowTip = function(self) frame.ShowTip = function(self)
self.tipFrameIsVisible = true self.tipFrame:Show()
self.tipFrame.frame:Show()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30) self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30)
self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28) self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28)
end end
frame.HideTip = function(self) frame.HideTip = function(self)
self.tipFrameIsVisible = false self.tipFrame:Hide()
self.tipFrame.frame:Hide()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12) self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10) self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
end end
@@ -530,12 +470,12 @@ function OptionsPrivate.CreateFrame()
local container = AceGUI:Create("InlineGroup") local container = AceGUI:Create("InlineGroup")
container.frame:SetParent(frame) container.frame:SetParent(frame)
container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10) container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14) container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0)
container.frame:Show() container.frame:Show()
container.titletext:Hide() container.titletext:Hide()
-- Hide the border -- Hide the border
container.content:GetParent():SetBackdrop(nil) container.content:GetParent():SetBackdrop(nil)
container.content:SetPoint("TOPLEFT", 0, 0) container.content:SetPoint("TOPLEFT", 0, -28)
container.content:SetPoint("BOTTOMRIGHT", 0, 0) container.content:SetPoint("BOTTOMRIGHT", 0, 0)
frame.container = container frame.container = container
@@ -550,7 +490,7 @@ function OptionsPrivate.CreateFrame()
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame) frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
-- filter line -- filter line
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate") local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "WA_InputBoxTemplate")
filterInput:SetAutoFocus(false) filterInput:SetAutoFocus(false)
filterInput:SetTextInsets(16, 20, 0, 0) filterInput:SetTextInsets(16, 20, 0, 0)
@@ -613,9 +553,9 @@ function OptionsPrivate.CreateFrame()
OptionsPrivate.SortDisplayButtons(filterInput:GetText()) OptionsPrivate.SortDisplayButtons(filterInput:GetText())
end) end)
filterInput:SetHeight(15) filterInput:SetHeight(15)
filterInput:SetPoint("TOP", frame, "TOP", 0, -44) filterInput:SetPoint("TOP", frame, "TOP", 0, -65)
filterInput:SetPoint("LEFT", frame, "LEFT", 24, 0) filterInput:SetPoint("LEFT", frame, "LEFT", 24, 0)
filterInput:SetPoint("RIGHT", container.frame, "LEFT", -5, 0) filterInput:SetPoint("RIGHT", container.frame, "LEFT", -2, 0)
filterInput:SetFont(STANDARD_TEXT_FONT, 10) filterInput:SetFont(STANDARD_TEXT_FONT, 10)
frame.filterInput = filterInput frame.filterInput = filterInput
filterInput:Hide() filterInput:Hide()
@@ -625,53 +565,36 @@ function OptionsPrivate.CreateFrame()
buttonsContainer:SetWidth(170) buttonsContainer:SetWidth(170)
buttonsContainer.frame:SetParent(frame) buttonsContainer.frame:SetParent(frame)
buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12) buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -46) buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -67)
buttonsContainer.frame:SetPoint("RIGHT", container.frame, "LEFT", -17) buttonsContainer.frame:SetPoint("RIGHT", container.frame, "LEFT", -17)
buttonsContainer.frame:Show() buttonsContainer.frame:Show()
frame.buttonsContainer = buttonsContainer frame.buttonsContainer = buttonsContainer
-- Toolbar -- Toolbar
local toolbarContainer = AceGUI:Create("SimpleGroup") local toolbarContainer = CreateFrame("Frame", nil, buttonsContainer.frame)
toolbarContainer.frame:SetParent(buttonsContainer.frame) toolbarContainer:SetParent(buttonsContainer.frame)
toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -16) toolbarContainer:Hide()
toolbarContainer.frame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -17, -16)
toolbarContainer.frame:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 20, -38)
toolbarContainer:SetLayout("Flow")
local newButton = AceGUI:Create("WeakAurasToolbarButton")
newButton:SetText(L["New Aura"])
newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
toolbarContainer:AddChild(newButton)
frame.toolbarContainer = toolbarContainer
newButton:SetCallback("OnClick", function()
frame:NewAura()
end)
local importButton = AceGUI:Create("WeakAurasToolbarButton") local importButton = AceGUI:Create("WeakAurasToolbarButton")
importButton:SetText(L["Import"]) importButton:SetText(L["Import"])
importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall") importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall")
importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString) importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString)
toolbarContainer:AddChild(importButton) importButton.frame:SetParent(toolbarContainer)
importButton.frame:Show()
importButton:SetPoint("RIGHT", filterInput, "RIGHT")
importButton:SetPoint("BOTTOM", frame, "TOP", 0, -55)
local lockButton = AceGUI:Create("WeakAurasToolbarButton") local newButton = AceGUI:Create("WeakAurasToolbarButton")
lockButton:SetText(L["Lock Positions"]) newButton:SetText(L["New Aura"])
lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition") newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
lockButton:SetCallback("OnClick", function(self) newButton.frame:SetParent(toolbarContainer)
if WeakAurasOptionsSaved.lockPositions then newButton.frame:Show()
lockButton:SetStrongHighlight(false) newButton:SetPoint("RIGHT", importButton.frame, "LEFT", -10, 0)
lockButton:UnlockHighlight() frame.toolbarContainer = toolbarContainer
WeakAurasOptionsSaved.lockPositions = false
else newButton:SetCallback("OnClick", function()
lockButton:SetStrongHighlight(true) frame:NewAura()
lockButton:LockHighlight()
WeakAurasOptionsSaved.lockPositions = true
end
end) end)
if WeakAurasOptionsSaved.lockPositions then
lockButton:LockHighlight()
end
toolbarContainer:AddChild(lockButton)
local magnetButton = AceGUI:Create("WeakAurasToolbarButton") local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
magnetButton:SetText(L["Magnetically Align"]) magnetButton:SetText(L["Magnetically Align"])
@@ -691,7 +614,30 @@ function OptionsPrivate.CreateFrame()
if WeakAurasOptionsSaved.magnetAlign then if WeakAurasOptionsSaved.magnetAlign then
magnetButton:LockHighlight() magnetButton:LockHighlight()
end end
toolbarContainer:AddChild(magnetButton) magnetButton.frame:SetParent(toolbarContainer)
magnetButton.frame:Show()
magnetButton:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -17, -55)
local lockButton = AceGUI:Create("WeakAurasToolbarButton")
lockButton:SetText(L["Lock Positions"])
lockButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\lockPosition")
lockButton:SetCallback("OnClick", function(self)
if WeakAurasOptionsSaved.lockPositions then
lockButton:SetStrongHighlight(false)
lockButton:UnlockHighlight()
WeakAurasOptionsSaved.lockPositions = false
else
lockButton:SetStrongHighlight(true)
lockButton:LockHighlight()
WeakAurasOptionsSaved.lockPositions = true
end
end)
if WeakAurasOptionsSaved.lockPositions then
lockButton:LockHighlight()
end
lockButton.frame:SetParent(toolbarContainer)
lockButton.frame:Show()
lockButton:SetPoint("RIGHT", magnetButton.frame, "LEFT", -10, 0)
local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4) loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4)
@@ -703,7 +649,6 @@ function OptionsPrivate.CreateFrame()
self:UpdateFrameVisible() self:UpdateFrameVisible()
end end
local buttonsScroll = AceGUI:Create("ScrollFrame") local buttonsScroll = AceGUI:Create("ScrollFrame")
buttonsScroll:SetLayout("ButtonsScrollLayout") buttonsScroll:SetLayout("ButtonsScrollLayout")
buttonsScroll.width = "fill" buttonsScroll.width = "fill"
@@ -806,7 +751,7 @@ function OptionsPrivate.CreateFrame()
-- Loaded section -- Loaded section
local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton") local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
loadedButton:SetText(L["Loaded"]) loadedButton:SetText(L["Loaded/Standby"])
loadedButton:Disable() loadedButton:Disable()
loadedButton:EnableExpand() loadedButton:EnableExpand()
if odb.loadedCollapse then if odb.loadedCollapse then
@@ -825,34 +770,33 @@ function OptionsPrivate.CreateFrame()
loadedButton:SetExpandDescription(L["Expand all loaded displays"]) loadedButton:SetExpandDescription(L["Expand all loaded displays"])
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"]) loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
loadedButton:SetViewClick(function() loadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if loadedButton.view.visibility == 2 then if loadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do for _, child in ipairs(loadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then if child:IsLoaded() then
child:PriorityHide(2) child:PriorityHide(2)
end end
end end
loadedButton:PriorityHide(2) loadedButton:PriorityHide(2)
else else
for id, child in pairs(displayButtons) do for _, child in ipairs(loadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then if child:IsLoaded() then
child:PriorityShow(2) child:PriorityShow(2)
end end
end end
loadedButton:PriorityShow(2) loadedButton:PriorityShow(2)
end end
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end) end)
loadedButton.RecheckVisibility = function(self) loadedButton.RecheckVisibility = function(self)
local none, all = true, true local none, all = true, true
for id, child in pairs(displayButtons) do for _, child in ipairs(loadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then if child:GetVisibility() ~= 2 then
if child:GetVisibility() ~= 2 then all = false
all = false end
end if child:GetVisibility() ~= 0 then
if child:GetVisibility() ~= 0 then none = false
none = false
end
end end
end end
local newVisibility local newVisibility
@@ -869,6 +813,7 @@ function OptionsPrivate.CreateFrame()
end end
end end
loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"]) loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"])
loadedButton.childButtons = {}
frame.loadedButton = loadedButton frame.loadedButton = loadedButton
-- Not Loaded section -- Not Loaded section
@@ -892,34 +837,28 @@ function OptionsPrivate.CreateFrame()
unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"]) unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"])
unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"]) unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"])
unloadedButton:SetViewClick(function() unloadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if unloadedButton.view.visibility == 2 then if unloadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do for _, child in ipairs(unloadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] == nil then child:PriorityHide(2)
child:PriorityHide(2)
end
end end
unloadedButton:PriorityHide(2) unloadedButton:PriorityHide(2)
else else
for id, child in pairs(displayButtons) do for _, child in ipairs(unloadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] == nil then child:PriorityShow(2)
child:PriorityShow(2)
end
end end
unloadedButton:PriorityShow(2) unloadedButton:PriorityShow(2)
end end
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end) end)
unloadedButton.RecheckVisibility = function(self) unloadedButton.RecheckVisibility = function(self)
local none, all = true, true local none, all = true, true
for id, child in pairs(displayButtons) do for _, child in ipairs(unloadedButton.childButtons) do
if OptionsPrivate.Private.loaded[id] == nil then if child:GetVisibility() ~= 2 then
if child:GetVisibility() ~= 2 then all = false
all = false end
end if child:GetVisibility() ~= 0 then
if child:GetVisibility() ~= 0 then none = false
none = false
end
end end
end end
local newVisibility local newVisibility
@@ -936,6 +875,7 @@ function OptionsPrivate.CreateFrame()
end end
end end
unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"]) unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"])
unloadedButton.childButtons = {}
frame.unloadedButton = unloadedButton frame.unloadedButton = unloadedButton
@@ -998,7 +938,7 @@ function OptionsPrivate.CreateFrame()
local optionTable = self:EnsureOptions(data, self.selectedTab) local optionTable = self:EnsureOptions(data, self.selectedTab)
if optionTable then if optionTable then
AceConfig:RegisterOptionsTable("WeakAuras", optionTable) AceConfigRegistry:RegisterOptionsTable("WeakAuras", optionTable, true)
end end
end end
@@ -1049,7 +989,7 @@ function OptionsPrivate.CreateFrame()
local tabsWidget local tabsWidget
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14) container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -10)
container:ReleaseChildren() container:ReleaseChildren()
container:SetLayout("Fill") container:SetLayout("Fill")
tabsWidget = AceGUI:Create("TabGroup") tabsWidget = AceGUI:Create("TabGroup")
@@ -1122,12 +1062,18 @@ function OptionsPrivate.CreateFrame()
end end
frame.ClearPicks = function(self, noHide) frame.ClearPicks = function(self, noHide)
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do for id, button in pairs(displayButtons) do
button:ClearPick(true) button:ClearPick(true)
if not noHide then if not noHide then
button:PriorityHide(1) button:PriorityHide(1)
button:SetVisibilityDirectly(0) end
end
if not noHide then
for id, button in pairs(displayButtons) do
if button.data.controlledChildren then
button:RecheckVisibility()
end
end end
end end
@@ -1139,7 +1085,7 @@ function OptionsPrivate.CreateFrame()
container:ReleaseChildren() container:ReleaseChildren()
self.moversizer:Hide() self.moversizer:Hide()
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
-- Clear trigger expand state -- Clear trigger expand state
OptionsPrivate.ClearTriggerExpandState() OptionsPrivate.ClearTriggerExpandState()
@@ -1185,7 +1131,7 @@ function OptionsPrivate.CreateFrame()
self.pickedOption = "New" self.pickedOption = "New"
container:ReleaseChildren() container:ReleaseChildren()
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -8) container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, 0)
container:SetLayout("fill") container:SetLayout("fill")
local border = AceGUI:Create("InlineGroup") local border = AceGUI:Create("InlineGroup")
border:SetLayout("Fill") border:SetLayout("Fill")
@@ -1349,11 +1295,11 @@ function OptionsPrivate.CreateFrame()
end end
end end
if self.pickedDisplay == id then if self.pickedDisplay == id and (self.pickedDisplay == tab or tab == nil) then
return return
end end
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
self:ClearPicks(noHide) self:ClearPicks(noHide)
@@ -1380,7 +1326,7 @@ function OptionsPrivate.CreateFrame()
end end
displayButtons[data.id]:RecheckParentVisibility() displayButtons[data.id]:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end end
frame.CenterOnPicked = function(self) frame.CenterOnPicked = function(self)
+24 -68
View File
@@ -151,17 +151,11 @@ end]=]
local function ConstructTextEditor(frame) local function ConstructTextEditor(frame)
local group = AceGUI:Create("WeakAurasInlineGroup") local group = AceGUI:Create("WeakAurasInlineGroup")
group.frame:SetParent(frame) group.frame:SetParent(frame)
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:Hide() group.frame:Hide()
group:SetLayout("flow") 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") local editor = AceGUI:Create("MultiLineEditBox")
editor:SetFullWidth(true) editor:SetFullWidth(true)
editor:SetFullHeight(true) editor:SetFullHeight(true)
@@ -224,28 +218,12 @@ local function ConstructTextEditor(frame)
settings_frame:RegisterForClicks("LeftButtonUp") settings_frame:RegisterForClicks("LeftButtonUp")
local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
helpButton:SetPoint("BOTTOMLEFT", 12, -24) helpButton:SetPoint("BOTTOMLEFT", 0, -24)
helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1) helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1)
helpButton:SetHeight(20) helpButton:SetHeight(20)
helpButton:SetWidth(100) helpButton:SetWidth(100)
helpButton:SetText(L["Help"]) helpButton:SetText(L["Help"])
local urlText = CreateFrame("editbox", nil, group.frame)
urlText:SetFrameLevel(cancel:GetFrameLevel() + 1)
urlText:SetFont(STANDARD_TEXT_FONT, 12)
urlText:EnableMouse(true)
urlText:SetAutoFocus(false)
urlText:SetCountInvisibleLetters(false)
urlText:Hide()
local urlCopyLabel = urlText:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
urlCopyLabel:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMLEFT", 12, -20)
urlCopyLabel:SetText(L["Press Ctrl+C to copy"])
urlCopyLabel:Hide()
urlText:SetPoint("TOPLEFT", urlCopyLabel, "TOPRIGHT", 12, 0)
urlText:SetPoint("RIGHT", settings_frame, "LEFT")
local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate") local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate")
local function settings_dropdown_initialize(frame, level, menu) local function settings_dropdown_initialize(frame, level, menu)
@@ -317,7 +295,7 @@ local function ConstructTextEditor(frame)
-- Make Snippets button (top right, near the line number) -- Make Snippets button (top right, near the line number)
local snippetsButton = CreateFrame("Button", "WASnippetsButton", group.frame, "UIPanelButtonTemplate") local snippetsButton = CreateFrame("Button", "WASnippetsButton", group.frame, "UIPanelButtonTemplate")
snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", 0, -15) snippetsButton:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -20, -10)
snippetsButton:SetFrameLevel(group.frame:GetFrameLevel() + 2) snippetsButton:SetFrameLevel(group.frame:GetFrameLevel() + 2)
snippetsButton:SetHeight(20) snippetsButton:SetHeight(20)
snippetsButton:SetWidth(100) snippetsButton:SetWidth(100)
@@ -413,10 +391,12 @@ local function ConstructTextEditor(frame)
end end
-- Make sidebar for snippets -- Make sidebar for snippets
local snippetsFrame = CreateFrame("FRAME", "WeakAurasSnippets", group.frame) local snippetsFrame = CreateFrame("Frame", "WeakAurasSnippets", group.frame, "WA_PortraitFrameTemplate")
snippetsFrame:HidePortrait()
snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0) snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0)
snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0) snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0)
snippetsFrame:SetWidth(250) snippetsFrame:SetWidth(250)
--[[
snippetsFrame:SetBackdrop( snippetsFrame:SetBackdrop(
{ {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
@@ -428,11 +408,11 @@ local function ConstructTextEditor(frame)
} }
) )
snippetsFrame:SetBackdropColor(0, 0, 0, 1) snippetsFrame:SetBackdropColor(0, 0, 0, 1)
]]
-- Add button to save new snippet -- Add button to save new snippet
local AddSnippetButton = CreateFrame("Button", nil, snippetsFrame, "UIPanelButtonTemplate") local AddSnippetButton = CreateFrame("Button", nil, snippetsFrame, "UIPanelButtonTemplate")
AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -10) AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -25)
AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -10) AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -25)
AddSnippetButton:SetHeight(20) AddSnippetButton:SetHeight(20)
AddSnippetButton:SetText(L["Add Snippet"]) AddSnippetButton:SetText(L["Add Snippet"])
AddSnippetButton:RegisterForClicks("LeftButtonUp") AddSnippetButton:RegisterForClicks("LeftButtonUp")
@@ -444,7 +424,7 @@ local function ConstructTextEditor(frame)
snippetsScrollContainer:SetFullHeight(true) snippetsScrollContainer:SetFullHeight(true)
snippetsScrollContainer:SetLayout("Fill") snippetsScrollContainer:SetLayout("Fill")
snippetsScrollContainer.frame:SetParent(snippetsFrame) snippetsScrollContainer.frame:SetParent(snippetsFrame)
snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -35) snippetsScrollContainer.frame:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 17, -50)
snippetsScrollContainer.frame:SetPoint("BOTTOMRIGHT", snippetsFrame, "BOTTOMRIGHT", -10, 10) snippetsScrollContainer.frame:SetPoint("BOTTOMRIGHT", snippetsFrame, "BOTTOMRIGHT", -10, 10)
local snippetsScroll = AceGUI:Create("ScrollFrame") local snippetsScroll = AceGUI:Create("ScrollFrame")
snippetsScroll:SetLayout("List") snippetsScroll:SetLayout("List")
@@ -535,46 +515,26 @@ local function ConstructTextEditor(frame)
editorError:SetPoint("LEFT", helpButton, "RIGHT", 0, 4) editorError:SetPoint("LEFT", helpButton, "RIGHT", 0, 4)
editorError:SetPoint("RIGHT", settings_frame, "LEFT") editorError:SetPoint("RIGHT", settings_frame, "LEFT")
local editorLine = CreateFrame("Editbox", nil, group.frame) local editorLine = CreateFrame("EditBox", nil, group.frame, "WA_InputBoxTemplate")
-- Set script on enter pressed.. -- Set script on enter pressed..
editorLine:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -100, -15) editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0)
editorLine:SetFont(STANDARD_TEXT_FONT, 10) editorLine:SetFont(STANDARD_TEXT_FONT, 10)
editorLine:SetJustifyH("RIGHT") editorLine:SetJustifyH("RIGHT")
editorLine:SetWidth(80) editorLine:SetWidth(30)
editorLine:SetHeight(20) editorLine:SetHeight(20)
editorLine:SetNumeric(true) editorLine:SetNumeric(true)
editorLine:SetTextInsets(10, 10, 0, 0) editorLine:SetTextInsets(0, 5, 0, 0)
editorLine:SetAutoFocus(false) editorLine:SetAutoFocus(false)
urlText:SetScript( local editorLineText = group.frame:CreateFontString(nil, "OVERLAY")
"OnChar", editorLineText:SetFont(STANDARD_TEXT_FONT, 10)
function(self) editorLineText:SetTextColor(1, 1, 1)
self:SetText(group.url) editorLineText:SetText(L["Line"])
self:HighlightText() editorLineText:SetPoint("RIGHT", editorLine, "LEFT", -8, 0)
end
)
urlText:SetScript(
"OnEscapePressed",
function()
urlText:ClearFocus()
urlText:Hide()
urlCopyLabel:Hide()
helpButton:Show()
editor:SetFocus()
end
)
helpButton:SetScript( helpButton:SetScript("OnClick", function()
"OnClick", OptionsPrivate.ToggleTip(helpButton, group.url, L["Help"], "")
function() end)
urlText:Show()
urlText:SetFocus()
urlText:HighlightText()
urlCopyLabel:Show()
helpButton:Hide()
editorError:Hide()
end
)
local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged") local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged")
editor.editBox:SetScript( editor.editBox:SetScript(
@@ -616,9 +576,6 @@ local function ConstructTextEditor(frame)
self.reloadOptions = reloadOptions self.reloadOptions = reloadOptions
self.setOnParent = setOnParent self.setOnParent = setOnParent
self.url = url self.url = url
urlText:SetText(url or "")
urlText:Hide()
urlCopyLabel:Hide()
if url then if url then
helpButton:Show() helpButton:Show()
else else
@@ -668,8 +625,6 @@ local function ConstructTextEditor(frame)
end end
end end
if errorString then if errorString then
urlText:Hide()
urlCopyLabel:Hide()
if self.url then if self.url then
helpButton:Show() helpButton:Show()
end end
@@ -727,6 +682,7 @@ local function ConstructTextEditor(frame)
function group.CancelClose(self) function group.CancelClose(self)
editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged) editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged)
editor:ClearFocus() editor:ClearFocus()
frame:HideTip()
frame.window = "default" frame.window = "default"
frame:UpdateFrameVisible() frame:UpdateFrameVisible()
end end
@@ -76,10 +76,10 @@ end
local texturePicker local texturePicker
local function ConstructTexturePicker(frame) local function ConstructTexturePicker(frame)
local group = AceGUI:Create("InlineGroup"); local group = AceGUI:Create("SimpleGroup");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50);
group.frame:Hide(); group.frame:Hide();
group.children = {}; group.children = {};
group.categories = {}; group.categories = {};
@@ -247,7 +247,7 @@ local function ConstructTexturePicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate") local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
cancel:SetScript("OnClick", group.CancelClose) cancel:SetScript("OnClick", group.CancelClose)
cancel:SetPoint("BOTTOMRIGHT", -27, -23) cancel:SetPoint("BOTTOMRIGHT", -20, -24)
cancel:SetSize(100, 20) cancel:SetSize(100, 20)
cancel:SetText(L["Cancel"]) cancel:SetText(L["Cancel"])
+3 -1
View File
@@ -1835,6 +1835,7 @@ local methods = {
button:SetGroupOrder(nil, nil) button:SetGroupOrder(nil, nil)
end end
button.callbacks.UpdateExpandButton() button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
WeakAuras.UpdateGroupOrders(data) WeakAuras.UpdateGroupOrders(data)
WeakAuras.UpdateThumbnail(data) WeakAuras.UpdateThumbnail(data)
WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.ClearAndUpdateOptions(data.id)
@@ -1896,6 +1897,7 @@ local methods = {
button:SetGroupOrder(nil, nil) button:SetGroupOrder(nil, nil)
end end
button.callbacks.UpdateExpandButton() button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
WeakAuras.UpdateGroupOrders(data) WeakAuras.UpdateGroupOrders(data)
WeakAuras.UpdateThumbnail(data) WeakAuras.UpdateThumbnail(data)
WeakAuras.ClearAndUpdateOptions(data.id) WeakAuras.ClearAndUpdateOptions(data.id)
@@ -1998,7 +2000,7 @@ local updateFrame
local function ConstructUpdateFrame(frame) local function ConstructUpdateFrame(frame)
local group = AceGUI:Create("ScrollFrame"); local group = AceGUI:Create("ScrollFrame");
group.frame:SetParent(frame); group.frame:SetParent(frame);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16); group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46); group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide(); group.frame:Hide();
group:SetLayout("flow"); group:SetLayout("flow");
+77 -21
View File
@@ -101,6 +101,7 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex)
if not massEdit then if not massEdit then
local button = WeakAuras.GetDisplayButton(parentData.id) local button = WeakAuras.GetDisplayButton(parentData.id)
button.callbacks.UpdateExpandButton() button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
end end
OptionsPrivate.ClearOptions(parentData.id) OptionsPrivate.ClearOptions(parentData.id)
end end
@@ -286,6 +287,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
parentButton.callbacks.UpdateExpandButton(); parentButton.callbacks.UpdateExpandButton();
parentButton:Expand(); parentButton:Expand();
parentButton:ReloadTooltip(); parentButton:ReloadTooltip();
parentButton:UpdateParentWarning();
else else
WeakAuras.Add(data); WeakAuras.Add(data);
WeakAuras.NewDisplayButton(data); WeakAuras.NewDisplayButton(data);
@@ -309,6 +311,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
local oldParentButton = WeakAuras.GetDisplayButton(oldParent) local oldParentButton = WeakAuras.GetDisplayButton(oldParent)
oldParentButton.callbacks.UpdateExpandButton(); oldParentButton.callbacks.UpdateExpandButton();
oldParentButton:ReloadTooltip() oldParentButton:ReloadTooltip()
oldParentButton:UpdateParentWarning()
end end
tinsert(data.controlledChildren, childId); tinsert(data.controlledChildren, childId);
@@ -327,6 +330,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
local button = WeakAuras.GetDisplayButton(data.id); local button = WeakAuras.GetDisplayButton(data.id);
button.callbacks.UpdateExpandButton(); button.callbacks.UpdateExpandButton();
button:UpdateParentWarning()
OptionsPrivate.SortDisplayButtons(); OptionsPrivate.SortDisplayButtons();
button:Expand(); button:Expand();
@@ -441,7 +445,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = {
button2 = L["Cancel"], button2 = L["Cancel"],
OnAccept = function(self) OnAccept = function(self)
if self.data then if self.data then
OptionsPrivate.Private.PauseAllDynamicGroups() local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
OptionsPrivate.massDelete = true OptionsPrivate.massDelete = true
for _, auraData in pairs(self.data.toDelete) do for _, auraData in pairs(self.data.toDelete) do
WeakAuras.Delete(auraData) WeakAuras.Delete(auraData)
@@ -461,9 +465,10 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = {
parentButton:SetNormalTooltip() parentButton:SetNormalTooltip()
WeakAuras.Add(parentData) WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id) WeakAuras.ClearAndUpdateOptions(parentData.id)
parentButton:UpdateParentWarning()
end end
end end
OptionsPrivate.Private.ResumeAllDynamicGroups() OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.SortDisplayButtons(nil, true) OptionsPrivate.SortDisplayButtons(nil, true)
end end
end, end,
@@ -609,6 +614,13 @@ function WeakAuras.ToggleOptions(msg, Private)
-- The button does not yet exists if a new aura is created -- The button does not yet exists if a new aura is created
displayButtons[id]:UpdateWarning() displayButtons[id]:UpdateWarning()
end end
local data = Private.GetDataByUID(uid)
if data and data.parent then
local button = WeakAuras.GetDisplayButton(data.parent);
if button then
button:UpdateParentWarning()
end
end
end) end)
OptionsPrivate.Private.callbacks:RegisterCallback("ScanForLoads", AfterScanForLoads) OptionsPrivate.Private.callbacks:RegisterCallback("ScanForLoads", AfterScanForLoads)
@@ -735,16 +747,16 @@ local function LayoutDisplayButtons(msg)
frame.buttonsScroll:PerformLayout() frame.buttonsScroll:PerformLayout()
OptionsPrivate.SortDisplayButtons(msg); OptionsPrivate.SortDisplayButtons(msg);
OptionsPrivate.Private.PauseAllDynamicGroups(); local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if (WeakAuras.IsOptionsOpen()) then if (WeakAuras.IsOptionsOpen()) then
for id, button in pairs(displayButtons) do for id, button in pairs(displayButtons) do
if(OptionsPrivate.Private.loaded[id] ~= nil) then if OptionsPrivate.Private.loaded[id] then
button:PriorityShow(1); button:PriorityShow(1);
end end
end end
WeakAuras.OptionsFrame().loadedButton:RecheckVisibility() WeakAuras.OptionsFrame().loadedButton:RecheckVisibility()
end end
OptionsPrivate.Private.ResumeAllDynamicGroups(); OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
frame:SetLoadProgressVisible(false) frame:SetLoadProgressVisible(false)
end end
@@ -823,11 +835,11 @@ function WeakAuras.ShowOptions(msg)
if not(firstLoad) then if not(firstLoad) then
-- Show what was last shown -- Show what was last shown
OptionsPrivate.Private.PauseAllDynamicGroups(); local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do for id, button in pairs(displayButtons) do
button:SyncVisibility() button:SyncVisibility()
end end
OptionsPrivate.Private.ResumeAllDynamicGroups(); OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end end
if (frame.pickedDisplay) then if (frame.pickedDisplay) then
@@ -902,11 +914,12 @@ function OptionsPrivate.ConvertDisplay(data, newType)
local visibility = displayButtons[id]:GetVisibility(); local visibility = displayButtons[id]:GetVisibility();
displayButtons[id]:PriorityHide(2); displayButtons[id]:PriorityHide(2);
WeakAuras.regions[id].region:Collapse(); if WeakAuras.regions[id] then
WeakAuras.regions[id].region:Collapse()
end
OptionsPrivate.Private.CollapseAllClones(id); OptionsPrivate.Private.CollapseAllClones(id);
OptionsPrivate.Private.Convert(data, newType); OptionsPrivate.Private.Convert(data, newType);
displayButtons[id]:SetViewRegion(WeakAuras.regions[id].region);
displayButtons[id]:Initialize(); displayButtons[id]:Initialize();
displayButtons[id]:PriorityShow(visibility); displayButtons[id]:PriorityShow(visibility);
frame:ClearOptions(id) frame:ClearOptions(id)
@@ -1096,23 +1109,51 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
tinsert(frame.buttonsScroll.children, frame.loadedButton); tinsert(frame.buttonsScroll.children, frame.loadedButton);
local aurasMatchingFilter = {} local aurasMatchingFilter = {}
local useTextFilter = filter and filter ~= "" local useTextFilter = filter ~= ""
local filterTable = OptionsPrivate.Private.splitAtOr(filter)
local topLevelLoadedAuras = {} local topLevelLoadedAuras = {}
local topLevelUnloadedAuras = {} local topLevelUnloadedAuras = {}
local visible = {} local visible = {}
for id, child in pairs(displayButtons) do for id, child in pairs(displayButtons) do
if(OptionsPrivate.Private.loaded[id]) then if child.data.controlledChildren then
child:EnableLoaded(); local hasLoaded, hasStandBy, hasNotLoaded = 0, 0, 0
for leaf in OptionsPrivate.Private.TraverseLeafs(child.data) do
local id = leaf.id
if OptionsPrivate.Private.loaded[id] == true then
hasLoaded = hasLoaded + 1
elseif OptionsPrivate.Private.loaded[id] == false then
hasStandBy = hasStandBy + 1
else
hasNotLoaded = hasNotLoaded + 1
end
end
if hasLoaded > 0 then
child:SetLoaded(1, {0, 0.68, 0.30, 1}, L["Loaded"], L["%d displays loaded"]:format(hasLoaded))
elseif hasStandBy > 0 then
child:SetLoaded(2, {0.96, 0.82, 0.16, 1}, L["Standby"], L["%d displays on standby"]:format(hasStandBy))
elseif hasNotLoaded > 0 then
child:SetLoaded(3, {0.6, 0.6, 0.6, 1}, L["Not Loaded"], L["%d displays not loaded"]:format(hasNotLoaded))
else
child:ClearLoaded()
end
else else
child:DisableLoaded(); if OptionsPrivate.Private.loaded[id] == true then
child:SetLoaded(1, {0, 0.68, 0.30, 1}, L["Loaded"], L["This display is currently loaded"])
elseif OptionsPrivate.Private.loaded[id] == false then
child:SetLoaded(2, {0.96, 0.82, 0.16, 1}, L["Standby"], L["This display is on standby, it will be loaded when needed."])
else
child:SetLoaded(3, {0.6, 0.6, 0.6, 1}, L["Not Loaded"], L["This display is not currently loaded"])
end
end end
if useTextFilter then if useTextFilter then
if(id:lower():find(filter, 1, true)) then for _, word in ipairs(filterTable) do
aurasMatchingFilter[id] = true if(id:lower():find(word, 1, true)) then
for parent in OptionsPrivate.Private.TraverseParents(child.data) do aurasMatchingFilter[id] = true
aurasMatchingFilter[parent.id] = true for parent in OptionsPrivate.Private.TraverseParents(child.data) do
aurasMatchingFilter[parent.id] = true
end
end end
end end
else else
@@ -1121,7 +1162,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
if not child:GetGroup() then if not child:GetGroup() then
-- Top Level aura -- Top Level aura
if OptionsPrivate.Private.loaded[child.data.id] ~= nil then if OptionsPrivate.Private.loaded[id] ~= nil then
tinsert(topLevelLoadedAuras, id) tinsert(topLevelLoadedAuras, id)
else else
tinsert(topLevelUnloadedAuras, id) tinsert(topLevelUnloadedAuras, id)
@@ -1129,6 +1170,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
end end
end end
wipe(frame.loadedButton.childButtons)
if frame.loadedButton:GetExpanded() then if frame.loadedButton:GetExpanded() then
table.sort(topLevelLoadedAuras) table.sort(topLevelLoadedAuras)
for _, id in ipairs(topLevelLoadedAuras) do for _, id in ipairs(topLevelLoadedAuras) do
@@ -1138,8 +1180,15 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
end end
end end
for _, id in ipairs(topLevelLoadedAuras) do
for child in OptionsPrivate.Private.TraverseLeafsOrAura(WeakAuras.GetData(id)) do
tinsert(frame.loadedButton.childButtons, displayButtons[child.id])
end
end
tinsert(frame.buttonsScroll.children, frame.unloadedButton); tinsert(frame.buttonsScroll.children, frame.unloadedButton);
wipe(frame.unloadedButton.childButtons)
if frame.unloadedButton:GetExpanded() then if frame.unloadedButton:GetExpanded() then
table.sort(topLevelUnloadedAuras) table.sort(topLevelUnloadedAuras)
for _, id in ipairs(topLevelUnloadedAuras) do for _, id in ipairs(topLevelUnloadedAuras) do
@@ -1149,6 +1198,12 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
end end
end end
for _, id in ipairs(topLevelUnloadedAuras) do
for child in OptionsPrivate.Private.TraverseLeafsOrAura(WeakAuras.GetData(id)) do
tinsert(frame.unloadedButton.childButtons, displayButtons[child.id])
end
end
for id, child in pairs(displayButtons) do for id, child in pairs(displayButtons) do
if(not visible[child]) then if(not visible[child]) then
child.frame:Hide(); child.frame:Hide();
@@ -1290,9 +1345,6 @@ function OptionsPrivate.AddDisplayButton(data)
EnsureDisplayButton(data); EnsureDisplayButton(data);
WeakAuras.UpdateThumbnail(data); WeakAuras.UpdateThumbnail(data);
frame.buttonsScroll:AddChild(displayButtons[data.id]); frame.buttonsScroll:AddChild(displayButtons[data.id]);
if(WeakAuras.regions[data.id] and WeakAuras.regions[data.id].region.SetStacks) then
WeakAuras.regions[data.id].region:SetStacks(1);
end
end end
function OptionsPrivate.StartGrouping(data) function OptionsPrivate.StartGrouping(data)
@@ -1462,6 +1514,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area)
OptionsPrivate.SortDisplayButtons() OptionsPrivate.SortDisplayButtons()
OptionsPrivate.UpdateButtonsScroll() OptionsPrivate.UpdateButtonsScroll()
WeakAuras.FillOptions()
end end
function OptionsPrivate.StartDrag(mainAura) function OptionsPrivate.StartDrag(mainAura)
@@ -1506,6 +1559,7 @@ function OptionsPrivate.StartDrag(mainAura)
end end
end end
end end
OptionsPrivate.UpdateButtonsScroll()
end end
function OptionsPrivate.DropIndicator() function OptionsPrivate.DropIndicator()
@@ -1619,6 +1673,7 @@ function OptionsPrivate.ResetMoverSizer()
end end
function WeakAuras.SetMoverSizer(id) function WeakAuras.SetMoverSizer(id)
OptionsPrivate.Private.EnsureRegion(id)
if WeakAuras.regions[id].region.toShow then if WeakAuras.regions[id].region.toShow then
frame.moversizer:SetToRegion(WeakAuras.regions[id].region, db.displays[id]) frame.moversizer:SetToRegion(WeakAuras.regions[id].region, db.displays[id])
else else
@@ -1692,6 +1747,7 @@ function WeakAuras.NewAura(sourceData, regionType, targetId)
WeakAuras.UpdateGroupOrders(group.data); WeakAuras.UpdateGroupOrders(group.data);
OptionsPrivate.ClearOptions(group.data.id); OptionsPrivate.ClearOptions(group.data.id);
group.callbacks.UpdateExpandButton(); group.callbacks.UpdateExpandButton();
group:UpdateParentWarning();
group:Expand(); group:Expand();
group:ReloadTooltip(); group:ReloadTooltip();
OptionsPrivate.PickAndEditDisplay(data.id); OptionsPrivate.PickAndEditDisplay(data.id);
+1 -1
View File
@@ -1,7 +1,7 @@
## Interface: 30300 ## Interface: 30300
## Title: WeakAuras Options ## Title: WeakAuras Options
## Author: The WeakAuras Team ## Author: The WeakAuras Team
## Version: 4.1.1 ## Version: 4.1.2
## Notes: Options for WeakAuras ## Notes: Options for WeakAuras
## Notes-esES: Opciones para WeakAuras ## Notes-esES: Opciones para WeakAuras
## Notes-deDE: Optionen für WeakAuras ## Notes-deDE: Optionen für WeakAuras