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
@@ -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 tostring, error = tostring, error
local Type, Version = "WeakAurasDisplayButton", 57
local Type, Version = "WeakAurasDisplayButton", 59
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
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)
GameTooltip:SetOwner(owner, "ANCHOR_NONE");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("LEFT", owner, "RIGHT");
GameTooltip:ClearLines();
GameTooltip:AddLine(line1);
@@ -245,6 +246,7 @@ end
local function Show_Long_Tooltip(owner, description)
GameTooltip:SetOwner(owner, "ANCHOR_NONE");
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("LEFT", owner, "RIGHT");
GameTooltip:ClearLines();
local line = 1;
@@ -272,6 +274,8 @@ local function ensure(t, k, v)
return t and k and v and t[k] == v
end
local statusIconPool = CreateFramePool("Button")
--[[ Actions ]]--
local Actions = {
@@ -303,19 +307,17 @@ local Actions = {
WeakAuras.UpdateGroupOrders(group.data)
WeakAuras.ClearAndUpdateOptions(group.data.id)
WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
group.callbacks.UpdateExpandButton();
group:UpdateParentWarning()
group:ReloadTooltip()
else
WeakAuras.Add(source.data)
WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
end
else
-- move source into the top-level list
WeakAuras.Add(source.data)
WeakAuras.ClearAndUpdateOptions(source.data.id)
WeakAuras.FillOptions()
end
else
error("Calling 'Group' with invalid source. Reload your UI to fix the display list.")
@@ -337,6 +339,7 @@ local Actions = {
WeakAuras.ClearAndUpdateOptions(parent.id);
local group = WeakAuras.GetDisplayButton(parent.id)
group.callbacks.UpdateExpandButton();
group:UpdateParentWarning()
group:ReloadTooltip()
else
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
local tabsForWarning = {
sound_condition = "conditions",
sound_action = "action",
spammy_event_warning = "trigger"
}
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
@@ -474,7 +483,11 @@ local methods = {
UpdateClipboardMenuEntry(self.data);
EasyMenu(self.menu, WeakAuras_DropDownMenu, self.frame, 0, 0, "MENU");
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
else
@@ -531,6 +544,7 @@ local methods = {
WeakAuras.Add(self.data);
OptionsPrivate.Private.AddParents(self.data)
self.callbacks.UpdateExpandButton();
self:UpdateParentWarning();
OptionsPrivate.StopGrouping();
OptionsPrivate.ClearOptions(self.data.id);
WeakAuras.FillOptions();
@@ -600,22 +614,24 @@ local methods = {
-- This builds the group skeleton
DuplicateGroups(self.data, newGroup, mapping)
-- Do this after duplicating all groups
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
-- And this fills in the leafs
DuplicateAuras(self.data, newGroup, mapping)
local button = WeakAuras.GetDisplayButton(newGroup.id)
button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
for old, new in pairs(mapping) do
local button = WeakAuras.GetDisplayButton(new.id)
button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
end
OptionsPrivate.SortDisplayButtons(nil, true)
OptionsPrivate.PickAndEditDisplay(newGroup.id)
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
else
local new = OptionsPrivate.DuplicateAura(self.data)
OptionsPrivate.SortDisplayButtons(nil, true)
@@ -627,7 +643,6 @@ local methods = {
if (WeakAuras.IsImporting()) then return end;
local toDelete = {}
if(self.data.controlledChildren) then
local region = WeakAuras.regions[self.data.id];
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
tinsert(toDelete, child);
end
@@ -721,7 +736,7 @@ local methods = {
end
function self.callbacks.OnViewClick()
OptionsPrivate.Private.PauseAllDynamicGroups();
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if(self.view.visibility == 2) then
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
WeakAuras.GetDisplayButton(child.id):PriorityHide(2);
@@ -734,7 +749,7 @@ local methods = {
self:PriorityShow(2)
end
self:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups();
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end
function self.callbacks.OnRenameClick()
@@ -755,6 +770,7 @@ local methods = {
if not(newid == oldid) then
WeakAuras.Rename(self.data, newid);
end
self:UpdateParentWarning()
end
function self.callbacks.OnDragStart()
@@ -889,13 +905,10 @@ local methods = {
func = function() WeakAuras_DropDownMenu:Hide() end
});
if(self.data.controlledChildren) then
self.loaded:Hide();
self.expand:Show();
self.callbacks.UpdateExpandButton();
self:SetOnExpandCollapse(function() OptionsPrivate.SortDisplayButtons(nil, true) end);
else
self:SetViewRegion(WeakAuras.regions[self.data.id].region);
self.loaded:Show();
self.expand:Hide();
end
self.group:Show();
@@ -945,6 +958,9 @@ local methods = {
for index, childId in pairs(data.controlledChildren) do
tinsert(namestable, indent .. childId);
local childData = WeakAuras.GetData(childId)
if not childData then
return
end
if (childData.controlledChildren) then
addChildrenNames(childData, indent .. " ")
end
@@ -1011,13 +1027,13 @@ local methods = {
Show_Long_Tooltip(self.frame, self.frame.description);
end
end,
["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouing)
["StartGrouping"] = function(self, groupingData, selected, groupingGroup, childOfGrouping)
self.grouping = groupingData;
self:UpdateIconsVisible()
if(selected) then
self.frame:SetScript("OnClick", self.callbacks.OnClickGroupingSelf);
self:SetDescription(L["Cancel"], L["Do not group this display"]);
elseif (childOfGrouing) then
elseif (childOfGrouping) then
self:Disable();
else
if(self.data.regionType == "dynamicgroup" and groupingGroup) then
@@ -1031,11 +1047,13 @@ local methods = {
end
end,
["StopGrouping"] = function(self)
self.grouping = nil;
self:UpdateIconsVisible()
self:SetNormalTooltip();
self.frame:SetScript("OnClick", self.callbacks.OnClickNormal);
self:Enable();
if self.grouping then
self.grouping = nil
self:UpdateIconsVisible()
self:SetNormalTooltip()
self.frame:SetScript("OnClick", self.callbacks.OnClickNormal)
self:Enable()
end
end,
["Ungroup"] = function(self)
if (WeakAuras.IsImporting()) then return end;
@@ -1073,10 +1091,11 @@ local methods = {
end
WeakAuras.ClearAndUpdateOptions(self.data.id);
WeakAuras.UpdateGroupOrders(parentData);
local parentButton = WeakAuras.GetDisplayButton(parentData.id)
if(#parentData.controlledChildren == 0) then
local parentButton = WeakAuras.GetDisplayButton(parentData.id)
parentButton:DisableExpand()
end
parentButton:UpdateParentWarning()
for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do
local button = WeakAuras.GetDisplayButton(child.id)
@@ -1108,7 +1127,7 @@ local methods = {
self.frame:SetScript("OnClick", nil)
self.view:Hide()
self.expand:Hide()
self.loaded:Hide()
self.statusIcons:Hide()
Hide_Tooltip()
if picked then
self.frame:EnableKeyboard(true)
@@ -1152,7 +1171,6 @@ local methods = {
Show_DropIndicator(id)
end
self:UpdateIconsVisible()
OptionsPrivate.UpdateButtonsScroll()
else
-- Are we a valid target?
-- Top level auras that aren't groups aren't
@@ -1201,10 +1219,9 @@ local methods = {
self.frame:SetScript("OnClick", self.callbacks.OnClickNormal)
self.frame:EnableKeyboard(false); -- disables self.callbacks.OnKeyDown
self.view:Show()
self.statusIcons:Show()
if self.data.controlledChildren then
self.expand:Show()
else
self.loaded:Show()
end
self:Enable()
@@ -1255,9 +1272,6 @@ local methods = {
["SetDescription"] = function(self, ...)
self.frame.description = {...};
end,
["SetViewRegion"] = function(self, region)
self.view.region = region;
end,
["SetRenameAction"] = function(self, func)
self.renamebox.func = function()
func(self.renamebox:GetText());
@@ -1329,12 +1343,18 @@ local methods = {
return not OptionsPrivate.IsCollapsed(self.data.id, "displayButton", "", true)
end,
["DisableExpand"] = function(self)
if self.expand.disabled then
return
end
self.expand:Disable();
self.expand.disabled = true;
self.expand.expanded = false;
self.expand:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Disabled.blp");
end,
["EnableExpand"] = function(self)
if not self.expand.disabled then
return
end
self.expand.disabled = false;
if(self:GetExpanded()) then
self:Expand();
@@ -1342,23 +1362,119 @@ local methods = {
self:Collapse();
end
end,
["UpdateWarning"] = function(self)
local icon, title, warningText = OptionsPrivate.Private.AuraWarnings.FormatWarnings(self.data.uid)
if warningText then
self.warning:Show()
self.warning:SetNormalTexture(icon)
self.warning:SetScript("OnEnter", function()
["UpdateStatusIcon"] = function(self, key, prio, icon, title, tooltip, onClick, color)
local iconButton
for _, button in ipairs(self.statusIcons.buttons) do
if button.key == key then
iconButton = button
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(
self.frame,
title,
warningText
tooltip
)
end)
self.warning:SetScript("OnClick", function()
WeakAuras.PickDisplay(self.data.id, "information")
end)
iconButton:SetScript("OnLeave", Hide_Tooltip)
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,
["SetGroupOrder"] = function(self, order, max)
@@ -1387,15 +1503,22 @@ local methods = {
["GetGroupOrder"] = function(self)
return self.frame.dgrouporder;
end,
["DisableLoaded"] = function(self)
self.loaded.title = L["Not Loaded"];
self.loaded.desc = L["This display is not currently loaded"];
self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Disabled.blp");
["ClearLoaded"] = function(self)
self:ClearStatusIcon("load")
self:SortStatusIcons()
end,
["EnableLoaded"] = function(self)
self.loaded.title = L["Loaded"];
self.loaded.desc = L["This display is currently loaded"];
self.loaded:SetNormalTexture("Interface\\BUTTONS\\UI-GuildButton-OfficerNote-Up.blp");
["SetLoaded"] = function(self, prio, color, title, description)
self:UpdateStatusIcon("load", prio, {path="Interface\\AddOns\\WeakAuras\\Media\\Textures\\loaded"}, title, description, nil, color)
self:SortStatusIcons()
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,
["Pick"] = function(self)
self.frame:LockHighlight();
@@ -1414,24 +1537,25 @@ local methods = {
return;
end
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 (OptionsPrivate.Private.personalRessourceDisplayFrame) then
--OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.view.region.id);
--end
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:expand(self.view.region.id);
end
if not OptionsPrivate.Private.IsGroupType(self.data) then
OptionsPrivate.Private.FakeStatesFor(self.data.id, true)
end
--if (OptionsPrivate.Private.personalRessourceDisplayFrame) then
--OptionsPrivate.Private.personalRessourceDisplayFrame:expand(self.data.id);
--end
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:expand(self.data.id);
end
else
if(self.view.region and self.view.region.Collapse) then
OptionsPrivate.Private.FakeStatesFor(self.view.region.id, false)
if (OptionsPrivate.Private.personalRessourceDisplayFrame) then
OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.view.region.id);
end
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:collapse(self.view.region.id);
end
if not OptionsPrivate.Private.IsGroupType(self.data) then
OptionsPrivate.Private.FakeStatesFor(self.data.id, false)
end
if (OptionsPrivate.Private.personalRessourceDisplayFrame) then
OptionsPrivate.Private.personalRessourceDisplayFrame:collapse(self.data.id);
end
if (OptionsPrivate.Private.mouseFrame) then
OptionsPrivate.Private.mouseFrame:collapse(self.data.id);
end
end
end,
@@ -1444,8 +1568,9 @@ local methods = {
self:SyncVisibility()
self:UpdateViewTexture()
end
if self.view.region and self.view.region.ClickToPick then
self.view.region:ClickToPick();
local region = OptionsPrivate.Private.EnsureRegion(self.data.id)
if region and region.ClickToPick then
region:ClickToPick();
end
end,
["PriorityHide"] = function(self, priority)
@@ -1495,12 +1620,6 @@ local methods = {
self:RecheckParentVisibility()
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)
local visibility = self.view.visibility
if(visibility == 2) then
@@ -1520,8 +1639,10 @@ local methods = {
self.view:Disable();
self.group:Disable();
self.ungroup:Disable();
self.loaded:Disable();
self.expand:Disable();
for _, button in ipairs(self.statusIcons.buttons) do
button:Disable();
end
self:UpdateUpDownButtons()
end,
["Enable"] = function(self)
@@ -1530,7 +1651,9 @@ local methods = {
self.view:Enable();
self.group:Enable();
self.ungroup:Enable();
self.loaded:Enable();
for _, button in ipairs(self.statusIcons.buttons) do
button:Enable();
end
self:UpdateUpDownButtons()
if not(self.expand.disabled) then
self.expand:Enable();
@@ -1541,7 +1664,6 @@ local methods = {
end,
["OnRelease"] = function(self)
self:ReleaseThumbnail()
self:SetViewRegion();
self:Enable();
self:SetGroup();
self.renamebox:Hide();
@@ -1555,6 +1677,10 @@ local methods = {
--self.frame:EnableMouse(false);
self.frame:ClearAllPoints();
self.frame:Hide();
for _, button in ipairs(self.statusIcons.buttons) do
statusIconPool:Release(button)
end
wipe(self.statusIcons.buttons)
self.frame = nil;
self.data = nil;
end,
@@ -1644,7 +1770,8 @@ Constructor
local function Constructor()
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:SetWidth(1000);
button.dgroup = nil;
@@ -1683,7 +1810,8 @@ local function Constructor()
button.description = {};
local view = CreateFrame("BUTTON", nil, button);
---@class Button
local view = CreateFrame("Button", nil, button);
button.view = view;
view:SetWidth(16);
view:SetHeight(16);
@@ -1700,21 +1828,7 @@ local function Constructor()
view.visibility = 0;
local loaded = CreateFrame("BUTTON", nil, button);
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");
local renamebox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate");
renamebox:SetHeight(14);
renamebox:SetPoint("TOP", button, "TOP");
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("OnLeave", Hide_Tooltip);
local warning = CreateFrame("BUTTON", nil, button);
button.warning = warning
warning:SetWidth(16)
warning:SetHeight(16)
warning:SetPoint("RIGHT", button, "RIGHT", -60, 0)
warning:SetScript("OnLeave", Hide_Tooltip)
warning:Hide()
local statusIcons = CreateFrame("Frame", nil, button);
button.statusIcons = statusIcons
statusIcons:SetPoint("BOTTOM", button, "BOTTOM", 0, 1);
statusIcons:SetPoint("LEFT", icon, "RIGHT");
statusIcons:SetSize(1,1)
statusIcons.buttons = {}
local widget = {
frame = button,
@@ -1839,10 +1952,9 @@ local function Constructor()
ungroup = ungroup,
upgroup = upgroup,
downgroup = downgroup,
loaded = loaded,
background = background,
expand = expand,
warning = warning,
statusIcons = statusIcons,
type = Type,
offset = offset
}
@@ -1,6 +1,6 @@
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)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -151,7 +151,7 @@ local function Constructor()
button.background = background;
background:SetTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp");
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);
local expand = CreateFrame("BUTTON", nil, button);
@@ -179,7 +179,7 @@ local function Constructor()
view:SetPoint("RIGHT", button, "RIGHT", -16, 0);
local viewTexture = view:CreateTexture()
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:SetAllPoints(view);
view:SetNormalTexture(viewTexture);
@@ -84,6 +84,7 @@ end
local function OnEditFocusLost(self) -- EditBox
self:HighlightText(0, 0)
self.obj:Fire("OnEditFocusLost")
self.obj.scrollFrame:EnableMouseWheel(false);
end
local function OnEnter(self) -- EditBox / ScrollFrame
@@ -166,6 +167,7 @@ end
local function OnEditFocusGained(frame)
AceGUI:SetFocus(frame.obj)
frame.obj:Fire("OnEditFocusGained")
frame.obj.scrollFrame:EnableMouseWheel(true);
end
--[[-----------------------------------------------------------------------------
@@ -314,6 +316,7 @@ local function Constructor()
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate")
scrollFrame:EnableMouseWheel(false);
local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"]
scrollBar:ClearAllPoints()
@@ -189,7 +189,7 @@ local function Constructor()
deleteButton:SetPushedTexture(delPushed)
button.deleteHighlight = delHighlight
local renameEditBox = CreateFrame("EditBox", nil, button, "InputBoxTemplate")
local renameEditBox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate")
renameEditBox:SetHeight(14)
renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT")
renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT")
@@ -277,7 +277,7 @@ local methods = {
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)
frame:SetScript("OnEnter", Frame_OnEnter)
@@ -304,7 +304,7 @@ local function Constructor()
rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp")
rightbutton:SetScript("OnClick", SpinBox_OnValueUp)
local editbox = CreateFrame("EditBox", nil, frame, "InputBoxTemplate")
local editbox = CreateFrame("EditBox", nil, frame, "WA_InputBoxTemplate")
editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal)
editbox:SetHeight(19)
@@ -1,6 +1,6 @@
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)
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,
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);
local highlighttexture = button:CreateTexture(nil, "OVERLAY");
@@ -2,7 +2,7 @@
ToolbarButton Widget, based on AceGUI Button
Graphical Button.
-------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasToolbarButton", 4
local Type, Version = "WeakAurasToolbarButton", 6
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -23,10 +23,18 @@ local function Button_OnClick(frame, ...)
end
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")
end
local function Control_OnLeave(frame)
GameTooltip:Hide()
frame.obj:Fire("OnLeave")
end
@@ -54,6 +62,10 @@ local methods = {
end
end,
["SetTooltip"] = function(self, text)
self.frame.tooltip = text
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
+182 -67
View File
@@ -16,6 +16,7 @@ local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll)
local function filterAnimPresetTypes(intable, id)
local ret = {};
OptionsPrivate.Private.EnsureRegion(id)
local region = WeakAuras.regions[id] and WeakAuras.regions[id].region;
local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType;
local data = WeakAuras.GetData(id);
@@ -79,7 +80,8 @@ function OptionsPrivate.GetAnimationOptions(data)
data.animation[field] = data.animation[field] or {};
data.animation[field][value] = v;
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
for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do
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,
values = duration_types_no_choice,
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
},
start_duration_type = {
@@ -157,7 +161,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Time in"],
order = 33,
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 = {
type = "input",
@@ -275,7 +281,7 @@ function OptionsPrivate.GetAnimationOptions(data)
hidden = function()
return (
data.animation.start.type ~= "custom"
or not WeakAuras.regions[id].region.Scale
or not OptionsPrivate.Private.EnsureRegion(id).Scale
) end
},
start_scaleType = {
@@ -284,7 +290,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 43,
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
start_scalex = {
@@ -297,7 +305,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "range",
@@ -309,14 +319,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Rotate In"],
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 = {
type = "select",
@@ -324,7 +338,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 47,
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
start_rotate = {
@@ -336,14 +352,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0,
softMax = 360,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Color"],
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 = {
type = "select",
@@ -351,7 +371,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 48.5,
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
start_color = {
@@ -359,7 +381,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth,
name = L["Color"],
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()
return data.animation.start.colorR,
data.animation.start.colorG,
@@ -401,7 +425,9 @@ function OptionsPrivate.GetAnimationOptions(data)
order = 53,
values = duration_types_no_choice,
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
},
main_duration_type = {
@@ -410,7 +436,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Time in"],
order = 53,
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 = {
type = "input",
@@ -528,7 +556,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.normalWidth,
name = L["Zoom"],
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 = {
type = "select",
@@ -536,7 +566,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 63,
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
main_scalex = {
@@ -549,7 +581,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "range",
@@ -561,14 +595,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Rotate"],
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 = {
type = "select",
@@ -576,7 +614,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 67,
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
main_rotate = {
@@ -588,14 +628,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0,
softMax = 360,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Color"],
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 = {
type = "select",
@@ -603,7 +647,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 68.5,
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
main_color = {
@@ -611,7 +657,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth,
name = L["Color"],
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()
return data.animation.main.colorR,
data.animation.main.colorG,
@@ -757,7 +805,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.normalWidth,
name = L["Zoom Out"],
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 = {
type = "select",
@@ -765,7 +815,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 83,
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
finish_scalex = {
@@ -778,7 +830,9 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "range",
@@ -790,14 +844,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 5,
step = 0.01,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Rotate Out"],
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 = {
type = "select",
@@ -805,7 +863,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 87,
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
finish_rotate = {
@@ -817,14 +877,18 @@ function OptionsPrivate.GetAnimationOptions(data)
softMin = 0,
softMax = 360,
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 = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Color"],
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 = {
type = "select",
@@ -832,7 +896,9 @@ function OptionsPrivate.GetAnimationOptions(data)
name = L["Type"],
order = 88.5,
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
finish_color = {
@@ -840,7 +906,9 @@ function OptionsPrivate.GetAnimationOptions(data)
width = WeakAuras.doubleWidth,
name = L["Color"],
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()
return data.animation.finish.colorR,
data.animation.finish.colorG,
@@ -858,106 +926,153 @@ function OptionsPrivate.GetAnimationOptions(data)
}
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
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
-- Text Editors for "start"
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
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);
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
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);
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
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);
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
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);
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
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);
-- Text Editors for "main"
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
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);
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
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);
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
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);
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
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);
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
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);
-- Text Editors for "finish"
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
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);
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
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);
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
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);
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
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);
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
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);
if(data.controlledChildren) then
+2 -2
View File
@@ -936,7 +936,7 @@ end
local function CreateSetAll(subOption, getAll)
return function(data, info, ...)
OptionsPrivate.Private.pauseOptionsProcessing(true);
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
local before = getAll(data, info, ...)
for child in OptionsPrivate.Private.TraverseLeafs(data) do
local childOptions = OptionsPrivate.EnsureOptions(child, subOption)
@@ -974,7 +974,7 @@ local function CreateSetAll(subOption, getAll)
end
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.Private.pauseOptionsProcessing(false);
OptionsPrivate.Private.ScanForLoads();
OptionsPrivate.SortDisplayButtons(nil, true);
+21 -2
View File
@@ -44,7 +44,7 @@ local function GetCustomTriggerOptions(data, triggernum)
check = {
type = "select",
name = L["Check On..."],
width = WeakAuras.doubleWidth / 3,
width = WeakAuras.doubleWidth,
order = 8,
values = OptionsPrivate.Private.check_types,
hidden = function() return not (trigger.type == "custom"
@@ -75,7 +75,9 @@ local function GetCustomTriggerOptions(data, triggernum)
},
events = {
type = "input",
width = WeakAuras.doubleWidth * 2 / 3,
multiline = true,
control = "WeakAuras-MultiLineEditBoxWithEnter",
width = WeakAuras.doubleWidth,
name = L["Event(s)"],
desc = L["Custom trigger status tooltip"],
order = 8.1,
@@ -90,6 +92,8 @@ local function GetCustomTriggerOptions(data, triggernum)
},
events2 = {
type = "input",
multiline = true,
control = "WeakAuras-MultiLineEditBoxWithEnter",
name = L["Event(s)"],
desc = L["Custom trigger event tooltip"],
width = WeakAuras.doubleWidth,
@@ -105,6 +109,7 @@ local function GetCustomTriggerOptions(data, triggernum)
type = "description",
name = function()
local events = trigger.custom_type == "event" and trigger.events2 or trigger.events
-- Check for errors
for index, event in pairs(WeakAuras.split(events)) do
local trueEvent
for i in event:gmatch("[^:]+") do
@@ -132,6 +137,13 @@ local function GetCustomTriggerOptions(data, triggernum)
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 ""
end,
width = WeakAuras.doubleWidth,
@@ -146,6 +158,7 @@ local function GetCustomTriggerOptions(data, triggernum)
return true
end
local events = trigger.custom_type == "event" and trigger.events2 or trigger.events
-- Check for errors
for index, event in pairs(WeakAuras.split(events)) do
local trueEvent
for i in event:gmatch("[^:]+") do
@@ -172,6 +185,12 @@ local function GetCustomTriggerOptions(data, triggernum)
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
end
},
@@ -58,17 +58,11 @@ local colorScheme = {
local function ConstructCodeReview(frame)
local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:Hide();
group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
title:SetText(L["Custom Code Viewer"])
group:AddChild(title)
local codeTree = AceGUI:Create("TreeGroup");
codeTree:SetTreeWidth(300, false)
codeTree:SetFullWidth(true)
+9 -11
View File
@@ -20,7 +20,7 @@ local spellCache = WeakAuras.spellCache
local function ConstructIconPicker(frame)
local group = AceGUI:Create("InlineGroup");
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:Hide();
group:SetLayout("fill");
@@ -95,23 +95,21 @@ local function ConstructIconPicker(frame)
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("OnEnterPressed", function(...) 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:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -12, -5);
local inputLabel = input:CreateFontString(nil, "OVERLAY", "GameFontNormal");
inputLabel:SetText(L["Search"]);
inputLabel:SetJustifyH("RIGHT");
inputLabel:SetPoint("BOTTOMLEFT", input, "TOPLEFT", 0, 5);
input:SetFont(STANDARD_TEXT_FONT, 10)
input:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, -10);
local icon = AceGUI:Create("WeakAurasIconButton");
icon.frame:Disable();
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");
iconLabel:SetNonSpaceWrap("true");
@@ -194,7 +192,7 @@ local function ConstructIconPicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
cancel:SetScript("OnClick", group.CancelClose);
cancel:SetPoint("bottomright", frame, "bottomright", -27, 11);
cancel:SetPoint("BOTTOMRIGHT", -20, -24)
cancel:SetHeight(20);
cancel:SetWidth(100);
cancel:SetText(L["Cancel"]);
@@ -17,16 +17,11 @@ local importexport
local function ConstructImportExport(frame)
local group = AceGUI:Create("WeakAurasInlineGroup");
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:Hide();
group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
group:AddChild(title)
local input = AceGUI:Create("MultiLineEditBox");
input:DisableButton(true)
input:SetFullWidth(true)
@@ -52,7 +47,7 @@ local function ConstructImportExport(frame)
frame.window = "importexport";
frame:UpdateFrameVisible()
if(mode == "export" or mode == "table") then
title:SetText(L["Exporting"])
OptionsPrivate.SetTitle(L["Exporting"])
if(id) then
local displayStr;
if(mode == "export") then
@@ -71,7 +66,7 @@ local function ConstructImportExport(frame)
input:SetFocus();
end
elseif(mode == "import") then
title:SetText(L["Importing"])
OptionsPrivate.SetTitle(L["Importing"])
input.editBox:SetScript("OnTextChanged", function(self)
local pasted = self:GetText()
pasted = pasted:match("^%s*(.-)%s*$")
@@ -2,7 +2,7 @@ if not WeakAuras.IsCorrectVersion() then return end
local AddonName, OptionsPrivate = ...
-- Lua APIs
local pairs, rad = pairs, rad
local rad = rad
-- WoW APIs
local CreateFrame = CreateFrame
@@ -50,14 +50,14 @@ local function ConstructModelPicker(frame)
end
end
local group = AceGUI:Create("InlineGroup");
local group = AceGUI:Create("SimpleGroup");
group.frame:SetParent(frame);
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:SetLayout("flow");
local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "InputBoxTemplate")
local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "WA_InputBoxTemplate")
filterInput:SetAutoFocus(false)
filterInput:SetTextInsets(16, 20, 0, 0)
@@ -123,8 +123,7 @@ local function ConstructModelPicker(frame)
group.modelTree:RefreshTree()
end)
filterInput:SetHeight(15)
filterInput:SetPoint("TOP", group.frame, "TOP", 0, 1)
filterInput:SetPoint("LEFT", group.frame, "LEFT", 7, 0)
filterInput:SetPoint("BOTTOMRIGHT", group.frame, "TOPRIGHT", -3, 5)
filterInput:SetWidth(200)
filterInput:SetFont(STANDARD_TEXT_FONT, 10)
group.frame.filterInput = filterInput
@@ -355,7 +354,7 @@ local function ConstructModelPicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
cancel:SetScript("OnClick", group.CancelClose);
cancel:SetPoint("bottomright", frame, "bottomright", -27, 16);
cancel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -27, 20);
cancel:SetHeight(20);
cancel:SetWidth(100);
cancel:SetText(L["Cancel"]);
@@ -383,7 +383,7 @@ local function BuildAlignLines(mover)
end
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
local scale = region:GetEffectiveScale() / UIParent:GetEffectiveScale()
if not IsControlKeyDown() then
@@ -652,7 +652,8 @@ local function ConstructMoverSizer(parent)
end
OptionsPrivate.Private.AddParents(data)
WeakAuras.FillOptions()
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main,
OptionsPrivate.Private.EnsureRegion(data.id), false, nil, true)
-- hide alignment lines
frame.lineY:Hide()
frame.lineX:Hide()
@@ -776,7 +777,8 @@ local function ConstructMoverSizer(parent)
frame.text:Hide()
frame:SetScript("OnUpdate", nil)
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
frame.lineY: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
local AceGUI = LibStub("AceGUI-3.0")
local AceConfig = LibStub("AceConfig-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local WeakAuras = WeakAuras
local L = WeakAuras.L
@@ -22,71 +22,26 @@ local regionOptions = WeakAuras.regionOptions
local tempGroup = OptionsPrivate.tempGroup
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)
callback = callback or (function() end)
local left, right, top, bottom, xOffset1, yOffset1, xOffset2, yOffset2
if position == "BOTTOMLEFT" then
left, right, top, bottom = 1, 0, 0, 1
xOffset1, yOffset1 = 6, 6
xOffset1, yOffset1 = 1, 1
xOffset2, yOffset2 = 0, 0
elseif position == "BOTTOMRIGHT" then
left, right, top, bottom = 0, 1, 0, 1
xOffset1, yOffset1 = 0, 6
xOffset2, yOffset2 = -6, 0
xOffset1, yOffset1 = 0, 1
xOffset2, yOffset2 = -1, 0
elseif position == "TOPLEFT" then
left, right, top, bottom = 1, 0, 1, 0
xOffset1, yOffset1 = 6, 0
xOffset2, yOffset2 = 0, -6
xOffset1, yOffset1 = 1, 0
xOffset2, yOffset2 = 0, -1
elseif position == "TOPRIGHT" then
left, right, top, bottom = 0, 1, 1, 0
xOffset1, yOffset1 = 0, 0
xOffset2, yOffset2 = -6, -6
xOffset2, yOffset2 = -1, -1
end
local handle = CreateFrame("BUTTON", nil, frame)
@@ -133,45 +88,52 @@ local minWidth = 750
local minHeight = 240
function OptionsPrivate.CreateFrame()
local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
local frame
local db = OptionsPrivate.savedVars.db
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())
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:SetMovable(true)
frame:SetResizable(true)
frame:SetMinResize(minWidth, minHeight)
frame:SetFrameStrata("DIALOG")
frame.PortraitContainer.portrait:SetTexture([[Interface\AddOns\WeakAuras\Media\Textures\logo_256_round.tga]])
frame.window = "default"
local xOffset, yOffset
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
if not (xOffset and yOffset) then
xOffset = (defaultWidth - GetScreenWidth()) / 2
yOffset = (defaultHeight - GetScreenHeight()) / 2
xOffset = GetScreenWidth() / 2
yOffset = GetScreenHeight() - defaultHeight / 2
end
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset)
frame:SetPoint("TOP", UIParent, "BOTTOMLEFT", xOffset, yOffset)
frame:Hide()
frame:SetScript("OnHide", function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
OptionsPrivate.Private.ClearFakeStates()
@@ -187,7 +149,7 @@ function OptionsPrivate.CreateFrame()
end
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.Private.Resume()
if OptionsPrivate.Private.mouseFrame then
@@ -201,8 +163,8 @@ function OptionsPrivate.CreateFrame()
local width, height
if db.frame then
width, height = db.frame.width, db.frame.height
if odb.frame then
width, height = odb.frame.width, odb.frame.height
end
if not (width and height) then
@@ -214,65 +176,34 @@ function OptionsPrivate.CreateFrame()
frame:SetWidth(width)
frame:SetHeight(height)
local close = CreateDecoration(frame)
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)
OptionsPrivate.SetTitle()
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
db.frame.width = frame:GetWidth()
db.frame.height = frame:GetHeight()
local xOffset = frame:GetRight()-(frame:GetWidth()/2)
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
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset)
end
title:EnableMouse(true)
title:SetScript("OnMouseDown", function() frame:StartMoving() end)
title:SetScript("OnMouseUp", function()
frame:SetScript("OnMouseDown", function()
frame:StartMoving()
end)
frame:SetScript("OnMouseUp", function()
frame:StopMovingOrSizing()
commitWindowChanges()
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")
local minimize = CreateDecoration(frame)
minimize:SetPoint("TOPRIGHT", -65, 12)
frame.UpdateFrameVisible = function(self)
self.tipPopup:Hide()
if self.minimized then
WeakAurasOptionsTitleText:Hide()
self.buttonsContainer.frame:Hide()
self.texturePicker.frame:Hide()
self.iconPicker.frame:Hide()
@@ -287,64 +218,68 @@ function OptionsPrivate.CreateFrame()
self.container.frame:Hide()
self.loadProgress:Hide()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
self.tipFrame.frame:Hide()
self.bottomLeftResizer:Hide()
self.tipFrame:Hide()
self:HideTip()
self.bottomRightResizer:Hide()
else
self.bottomLeftResizer:Show()
WeakAurasOptionsTitleText:Show()
self.bottomRightResizer:Show()
if self.window == "default" then
OptionsPrivate.SetTitle()
self.buttonsContainer.frame:Show()
self.container.frame:Show()
if self.tipFrameIsVisible then
self.tipFrame.frame:Show()
else
self.tipFrame.frame:Hide()
end
self:ShowTip()
else
self.buttonsContainer.frame:Hide()
self.container.frame:Hide()
self.tipFrame.frame:Hide()
self:HideTip()
end
if self.window == "texture" then
OptionsPrivate.SetTitle(L["Texture Picker"])
self.texturePicker.frame:Show()
else
self.texturePicker.frame:Hide()
end
if self.window == "icon" then
OptionsPrivate.SetTitle(L["Icon Picker"])
self.iconPicker.frame:Show()
else
self.iconPicker.frame:Hide()
end
if self.window == "model" then
OptionsPrivate.SetTitle(L["Model Picker"])
self.modelPicker.frame:Show()
else
self.modelPicker.frame:Hide()
end
if self.window == "importexport" then
OptionsPrivate.SetTitle(L["Import / Export"])
self.importexport.frame:Show()
else
self.importexport.frame:Hide()
end
if self.window == "texteditor" then
OptionsPrivate.SetTitle(L["Code Editor"])
self.texteditor.frame:Show()
else
self.texteditor.frame:Hide()
end
if self.window == "codereview" then
OptionsPrivate.SetTitle(L["Custom Code Viewer"])
self.codereview.frame:Show()
else
self.codereview.frame:Hide()
end
if self.window == "newView" then
OptionsPrivate.SetTitle(L["New Template"])
self.newView.frame:Show()
else
if self.newView then
@@ -352,6 +287,7 @@ function OptionsPrivate.CreateFrame()
end
end
if self.window == "update" then
OptionsPrivate.SetTitle(L["Update"])
self.update.frame:Show()
else
self.update.frame:Hide()
@@ -359,60 +295,52 @@ function OptionsPrivate.CreateFrame()
if self.window == "default" then
if self.loadProgessVisible then
self.loadProgress:Show()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
else
self.loadProgress:Hide()
self.toolbarContainer.frame:Show()
self.toolbarContainer:Show()
self.filterInput:Show();
--self.filterInputClear:Show();
end
else
self.loadProgress:Hide()
self.toolbarContainer.frame:Hide()
self.toolbarContainer:Hide()
self.filterInput:Hide();
end
end
end
local minimizebutton = CreateFrame("BUTTON", nil, minimize)
minimizebutton:SetWidth(30)
minimizebutton:SetHeight(30)
minimizebutton:SetPoint("CENTER", minimize, "CENTER", 1, -1)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp")
minimizebutton:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp")
minimizebutton:SetScript("OnClick", function()
if frame.minimized then
frame.minimized = nil
if db.frame then
if not db.frame.height or db.frame.height < 240 then
db.frame.height = 500
end
end
frame:SetHeight(db.frame and db.frame.height or 500)
minimizebutton:SetNormalTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Up.blp")
minimizebutton:SetPushedTexture("Interface\\BUTTONS\\UI-Panel-CollapseButton-Down.blp")
frame.buttonsScroll:DoLayout()
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
local minimizebutton = CreateFrame("Button", nil, frame, "WA_MaximizeMinimizeButtonFrameTemplate")
minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0)
minimizebutton:SetOnMaximizedCallback(function()
frame.minimized = false
local right, top = frame:GetRight(), frame:GetTop()
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
frame:SetHeight(odb.frame and odb.frame.height or defaultHeight)
frame:SetWidth(odb.frame and odb.frame.width or defaultWidth)
frame.buttonsScroll:DoLayout()
frame:UpdateFrameVisible()
end)
minimizebutton:SetOnMinimizedCallback(function()
commitWindowChanges()
frame.minimized = true
local right, top = frame:GetRight(), frame:GetTop()
frame:ClearAllPoints()
frame:SetPoint("TOPRIGHT", UIParent, "BOTTOMLEFT", right, top)
frame:SetHeight(75)
frame:SetWidth(160)
frame:UpdateFrameVisible()
end)
local tipFrame = AceGUI:Create("SimpleGroup")
tipFrame.frame:SetParent(frame)
tipFrame:SetLayout("Flow")
tipFrame.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 22, 15)
tipFrame.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 15)
tipFrame.frame:Hide()
local tipFrame = CreateFrame("Frame", nil, frame)
tipFrame:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 17, 30)
tipFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
tipFrame:Hide()
frame.tipFrame = tipFrame
local tipPopup = CreateFrame("Frame", nil, frame)
local tipPopup = CreateFrame("Frame", "WeakAuras_TipPopup", frame)
tipPopup:SetFrameStrata("FULLSCREEN")
tipPopup:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
@@ -425,6 +353,7 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetBackdropColor(0, 0, 0, 0.8)
--tipPopup:SetHeight(100)
tipPopup:Hide()
frame.tipPopup = tipPopup
local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge")
tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10)
@@ -438,7 +367,7 @@ function OptionsPrivate.CreateFrame()
tipPopupLabel:SetJustifyH("LEFT")
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:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0)
urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0)
@@ -454,7 +383,7 @@ function OptionsPrivate.CreateFrame()
tipPopupCtrlC:SetJustifyV("TOP")
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
tipPopup:Hide()
return
@@ -468,60 +397,71 @@ function OptionsPrivate.CreateFrame()
tipPopup:SetWidth(400)
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()
end
OptionsPrivate.ToggleTip = ToggleTip
local addFooter = function(title, texture, url, description)
local addFooter = function(title, texture, url, description, rightAligned)
local button = AceGUI:Create("WeakAurasToolbarButton")
button:SetText(title)
button:SetTexture(texture)
button:SetCallback("OnClick", function()
ToggleTip(button, url, title, description)
ToggleTip(button.frame, url, title, description, rightAligned)
end)
tipFrame:AddChild(button)
button.frame:Show()
return button.frame
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."])
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."])
documentationButton:SetParent(tipFrame)
documentationButton:SetPoint("LEFT", discordButton, "RIGHT", 10, 0)
local awesomeWotlkButton
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!"])
awesomeWotlkButton:SetParent(tipFrame)
awesomeWotlkButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0)
end
addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."])
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["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
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."])
companionButton:SetParent(tipFrame)
companionButton:SetPoint("RIGHT", wagoButton, "LEFT", -10, 0)
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)
self.tipFrameIsVisible = true
self.tipFrame.frame:Show()
self.tipFrame:Show()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30)
self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28)
end
frame.HideTip = function(self)
self.tipFrameIsVisible = false
self.tipFrame.frame:Hide()
self.tipFrame:Hide()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
end
@@ -530,12 +470,12 @@ function OptionsPrivate.CreateFrame()
local container = AceGUI:Create("InlineGroup")
container.frame:SetParent(frame)
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.titletext:Hide()
-- Hide the border
container.content:GetParent():SetBackdrop(nil)
container.content:SetPoint("TOPLEFT", 0, 0)
container.content:SetPoint("TOPLEFT", 0, -28)
container.content:SetPoint("BOTTOMRIGHT", 0, 0)
frame.container = container
@@ -550,7 +490,7 @@ function OptionsPrivate.CreateFrame()
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
-- filter line
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate")
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "WA_InputBoxTemplate")
filterInput:SetAutoFocus(false)
filterInput:SetTextInsets(16, 20, 0, 0)
@@ -613,9 +553,9 @@ function OptionsPrivate.CreateFrame()
OptionsPrivate.SortDisplayButtons(filterInput:GetText())
end)
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("RIGHT", container.frame, "LEFT", -5, 0)
filterInput:SetPoint("RIGHT", container.frame, "LEFT", -2, 0)
filterInput:SetFont(STANDARD_TEXT_FONT, 10)
frame.filterInput = filterInput
filterInput:Hide()
@@ -625,53 +565,36 @@ function OptionsPrivate.CreateFrame()
buttonsContainer:SetWidth(170)
buttonsContainer.frame:SetParent(frame)
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:Show()
frame.buttonsContainer = buttonsContainer
-- Toolbar
local toolbarContainer = AceGUI:Create("SimpleGroup")
toolbarContainer.frame:SetParent(buttonsContainer.frame)
toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -16)
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 toolbarContainer = CreateFrame("Frame", nil, buttonsContainer.frame)
toolbarContainer:SetParent(buttonsContainer.frame)
toolbarContainer:Hide()
local importButton = AceGUI:Create("WeakAurasToolbarButton")
importButton:SetText(L["Import"])
importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall")
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")
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
local newButton = AceGUI:Create("WeakAurasToolbarButton")
newButton:SetText(L["New Aura"])
newButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\newaura")
newButton.frame:SetParent(toolbarContainer)
newButton.frame:Show()
newButton:SetPoint("RIGHT", importButton.frame, "LEFT", -10, 0)
frame.toolbarContainer = toolbarContainer
newButton:SetCallback("OnClick", function()
frame:NewAura()
end)
if WeakAurasOptionsSaved.lockPositions then
lockButton:LockHighlight()
end
toolbarContainer:AddChild(lockButton)
local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
magnetButton:SetText(L["Magnetically Align"])
@@ -691,7 +614,30 @@ function OptionsPrivate.CreateFrame()
if WeakAurasOptionsSaved.magnetAlign then
magnetButton:LockHighlight()
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")
loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4)
@@ -703,7 +649,6 @@ function OptionsPrivate.CreateFrame()
self:UpdateFrameVisible()
end
local buttonsScroll = AceGUI:Create("ScrollFrame")
buttonsScroll:SetLayout("ButtonsScrollLayout")
buttonsScroll.width = "fill"
@@ -806,7 +751,7 @@ function OptionsPrivate.CreateFrame()
-- Loaded section
local loadedButton = AceGUI:Create("WeakAurasLoadedHeaderButton")
loadedButton:SetText(L["Loaded"])
loadedButton:SetText(L["Loaded/Standby"])
loadedButton:Disable()
loadedButton:EnableExpand()
if odb.loadedCollapse then
@@ -825,34 +770,33 @@ function OptionsPrivate.CreateFrame()
loadedButton:SetExpandDescription(L["Expand all loaded displays"])
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
loadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if loadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
for _, child in ipairs(loadedButton.childButtons) do
if child:IsLoaded() then
child:PriorityHide(2)
end
end
loadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
for _, child in ipairs(loadedButton.childButtons) do
if child:IsLoaded() then
child:PriorityShow(2)
end
end
loadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end)
loadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] ~= nil then
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
for _, child in ipairs(loadedButton.childButtons) do
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
end
local newVisibility
@@ -869,6 +813,7 @@ function OptionsPrivate.CreateFrame()
end
end
loadedButton:SetViewDescription(L["Toggle the visibility of all loaded displays"])
loadedButton.childButtons = {}
frame.loadedButton = loadedButton
-- Not Loaded section
@@ -892,34 +837,28 @@ function OptionsPrivate.CreateFrame()
unloadedButton:SetExpandDescription(L["Expand all non-loaded displays"])
unloadedButton:SetCollapseDescription(L["Collapse all non-loaded displays"])
unloadedButton:SetViewClick(function()
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if unloadedButton.view.visibility == 2 then
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityHide(2)
end
for _, child in ipairs(unloadedButton.childButtons) do
child:PriorityHide(2)
end
unloadedButton:PriorityHide(2)
else
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
child:PriorityShow(2)
end
for _, child in ipairs(unloadedButton.childButtons) do
child:PriorityShow(2)
end
unloadedButton:PriorityShow(2)
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end)
unloadedButton.RecheckVisibility = function(self)
local none, all = true, true
for id, child in pairs(displayButtons) do
if OptionsPrivate.Private.loaded[id] == nil then
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
for _, child in ipairs(unloadedButton.childButtons) do
if child:GetVisibility() ~= 2 then
all = false
end
if child:GetVisibility() ~= 0 then
none = false
end
end
local newVisibility
@@ -936,6 +875,7 @@ function OptionsPrivate.CreateFrame()
end
end
unloadedButton:SetViewDescription(L["Toggle the visibility of all non-loaded displays"])
unloadedButton.childButtons = {}
frame.unloadedButton = unloadedButton
@@ -998,7 +938,7 @@ function OptionsPrivate.CreateFrame()
local optionTable = self:EnsureOptions(data, self.selectedTab)
if optionTable then
AceConfig:RegisterOptionsTable("WeakAuras", optionTable)
AceConfigRegistry:RegisterOptionsTable("WeakAuras", optionTable, true)
end
end
@@ -1049,7 +989,7 @@ function OptionsPrivate.CreateFrame()
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:SetLayout("Fill")
tabsWidget = AceGUI:Create("TabGroup")
@@ -1122,12 +1062,18 @@ function OptionsPrivate.CreateFrame()
end
frame.ClearPicks = function(self, noHide)
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do
button:ClearPick(true)
if not noHide then
button:PriorityHide(1)
button:SetVisibilityDirectly(0)
end
end
if not noHide then
for id, button in pairs(displayButtons) do
if button.data.controlledChildren then
button:RecheckVisibility()
end
end
end
@@ -1139,7 +1085,7 @@ function OptionsPrivate.CreateFrame()
container:ReleaseChildren()
self.moversizer:Hide()
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
-- Clear trigger expand state
OptionsPrivate.ClearTriggerExpandState()
@@ -1185,7 +1131,7 @@ function OptionsPrivate.CreateFrame()
self.pickedOption = "New"
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")
local border = AceGUI:Create("InlineGroup")
border:SetLayout("Fill")
@@ -1349,11 +1295,11 @@ function OptionsPrivate.CreateFrame()
end
end
if self.pickedDisplay == id then
if self.pickedDisplay == id and (self.pickedDisplay == tab or tab == nil) then
return
end
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
self:ClearPicks(noHide)
@@ -1380,7 +1326,7 @@ function OptionsPrivate.CreateFrame()
end
displayButtons[data.id]:RecheckParentVisibility()
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end
frame.CenterOnPicked = function(self)
+24 -68
View File
@@ -151,17 +151,11 @@ end]=]
local function ConstructTextEditor(frame)
local group = AceGUI:Create("WeakAurasInlineGroup")
group.frame:SetParent(frame)
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -63);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:Hide()
group:SetLayout("flow")
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
title:SetText(L["Code Editor"])
group:AddChild(title)
local editor = AceGUI:Create("MultiLineEditBox")
editor:SetFullWidth(true)
editor:SetFullHeight(true)
@@ -224,28 +218,12 @@ local function ConstructTextEditor(frame)
settings_frame:RegisterForClicks("LeftButtonUp")
local helpButton = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
helpButton:SetPoint("BOTTOMLEFT", 12, -24)
helpButton:SetPoint("BOTTOMLEFT", 0, -24)
helpButton:SetFrameLevel(cancel:GetFrameLevel() + 1)
helpButton:SetHeight(20)
helpButton:SetWidth(100)
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 function settings_dropdown_initialize(frame, level, menu)
@@ -317,7 +295,7 @@ local function ConstructTextEditor(frame)
-- Make Snippets button (top right, near the line number)
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:SetHeight(20)
snippetsButton:SetWidth(100)
@@ -413,10 +391,12 @@ local function ConstructTextEditor(frame)
end
-- 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("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0)
snippetsFrame:SetWidth(250)
--[[
snippetsFrame:SetBackdrop(
{
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
@@ -428,11 +408,11 @@ local function ConstructTextEditor(frame)
}
)
snippetsFrame:SetBackdropColor(0, 0, 0, 1)
]]
-- Add button to save new snippet
local AddSnippetButton = CreateFrame("Button", nil, snippetsFrame, "UIPanelButtonTemplate")
AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -10)
AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -10)
AddSnippetButton:SetPoint("TOPLEFT", snippetsFrame, "TOPLEFT", 13, -25)
AddSnippetButton:SetPoint("TOPRIGHT", snippetsFrame, "TOPRIGHT", -13, -25)
AddSnippetButton:SetHeight(20)
AddSnippetButton:SetText(L["Add Snippet"])
AddSnippetButton:RegisterForClicks("LeftButtonUp")
@@ -444,7 +424,7 @@ local function ConstructTextEditor(frame)
snippetsScrollContainer:SetFullHeight(true)
snippetsScrollContainer:SetLayout("Fill")
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)
local snippetsScroll = AceGUI:Create("ScrollFrame")
snippetsScroll:SetLayout("List")
@@ -535,46 +515,26 @@ local function ConstructTextEditor(frame)
editorError:SetPoint("LEFT", helpButton, "RIGHT", 0, 4)
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..
editorLine:SetPoint("BOTTOMRIGHT", editor.frame, "TOPRIGHT", -100, -15)
editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0)
editorLine:SetFont(STANDARD_TEXT_FONT, 10)
editorLine:SetJustifyH("RIGHT")
editorLine:SetWidth(80)
editorLine:SetWidth(30)
editorLine:SetHeight(20)
editorLine:SetNumeric(true)
editorLine:SetTextInsets(10, 10, 0, 0)
editorLine:SetTextInsets(0, 5, 0, 0)
editorLine:SetAutoFocus(false)
urlText:SetScript(
"OnChar",
function(self)
self:SetText(group.url)
self:HighlightText()
end
)
urlText:SetScript(
"OnEscapePressed",
function()
urlText:ClearFocus()
urlText:Hide()
urlCopyLabel:Hide()
helpButton:Show()
editor:SetFocus()
end
)
local editorLineText = group.frame:CreateFontString(nil, "OVERLAY")
editorLineText:SetFont(STANDARD_TEXT_FONT, 10)
editorLineText:SetTextColor(1, 1, 1)
editorLineText:SetText(L["Line"])
editorLineText:SetPoint("RIGHT", editorLine, "LEFT", -8, 0)
helpButton:SetScript(
"OnClick",
function()
urlText:Show()
urlText:SetFocus()
urlText:HighlightText()
urlCopyLabel:Show()
helpButton:Hide()
editorError:Hide()
end
)
helpButton:SetScript("OnClick", function()
OptionsPrivate.ToggleTip(helpButton, group.url, L["Help"], "")
end)
local oldOnCursorChanged = editor.editBox:GetScript("OnCursorChanged")
editor.editBox:SetScript(
@@ -616,9 +576,6 @@ local function ConstructTextEditor(frame)
self.reloadOptions = reloadOptions
self.setOnParent = setOnParent
self.url = url
urlText:SetText(url or "")
urlText:Hide()
urlCopyLabel:Hide()
if url then
helpButton:Show()
else
@@ -668,8 +625,6 @@ local function ConstructTextEditor(frame)
end
end
if errorString then
urlText:Hide()
urlCopyLabel:Hide()
if self.url then
helpButton:Show()
end
@@ -727,6 +682,7 @@ local function ConstructTextEditor(frame)
function group.CancelClose(self)
editor.editBox:SetScript("OnTextChanged", self.oldOnTextChanged)
editor:ClearFocus()
frame:HideTip()
frame.window = "default"
frame:UpdateFrameVisible()
end
@@ -76,10 +76,10 @@ end
local texturePicker
local function ConstructTexturePicker(frame)
local group = AceGUI:Create("InlineGroup");
local group = AceGUI:Create("SimpleGroup");
group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 42);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 46);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -50);
group.frame:Hide();
group.children = {};
group.categories = {};
@@ -247,7 +247,7 @@ local function ConstructTexturePicker(frame)
local cancel = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate")
cancel:SetScript("OnClick", group.CancelClose)
cancel:SetPoint("BOTTOMRIGHT", -27, -23)
cancel:SetPoint("BOTTOMRIGHT", -20, -24)
cancel:SetSize(100, 20)
cancel:SetText(L["Cancel"])
+3 -1
View File
@@ -1835,6 +1835,7 @@ local methods = {
button:SetGroupOrder(nil, nil)
end
button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
WeakAuras.UpdateGroupOrders(data)
WeakAuras.UpdateThumbnail(data)
WeakAuras.ClearAndUpdateOptions(data.id)
@@ -1896,6 +1897,7 @@ local methods = {
button:SetGroupOrder(nil, nil)
end
button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
WeakAuras.UpdateGroupOrders(data)
WeakAuras.UpdateThumbnail(data)
WeakAuras.ClearAndUpdateOptions(data.id)
@@ -1998,7 +2000,7 @@ local updateFrame
local function ConstructUpdateFrame(frame)
local group = AceGUI:Create("ScrollFrame");
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:Hide();
group:SetLayout("flow");
+77 -21
View File
@@ -101,6 +101,7 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex)
if not massEdit then
local button = WeakAuras.GetDisplayButton(parentData.id)
button.callbacks.UpdateExpandButton()
button:UpdateParentWarning()
end
OptionsPrivate.ClearOptions(parentData.id)
end
@@ -286,6 +287,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
parentButton.callbacks.UpdateExpandButton();
parentButton:Expand();
parentButton:ReloadTooltip();
parentButton:UpdateParentWarning();
else
WeakAuras.Add(data);
WeakAuras.NewDisplayButton(data);
@@ -309,6 +311,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
local oldParentButton = WeakAuras.GetDisplayButton(oldParent)
oldParentButton.callbacks.UpdateExpandButton();
oldParentButton:ReloadTooltip()
oldParentButton:UpdateParentWarning()
end
tinsert(data.controlledChildren, childId);
@@ -327,6 +330,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions)
local button = WeakAuras.GetDisplayButton(data.id);
button.callbacks.UpdateExpandButton();
button:UpdateParentWarning()
OptionsPrivate.SortDisplayButtons();
button:Expand();
@@ -441,7 +445,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = {
button2 = L["Cancel"],
OnAccept = function(self)
if self.data then
OptionsPrivate.Private.PauseAllDynamicGroups()
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
OptionsPrivate.massDelete = true
for _, auraData in pairs(self.data.toDelete) do
WeakAuras.Delete(auraData)
@@ -461,9 +465,10 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = {
parentButton:SetNormalTooltip()
WeakAuras.Add(parentData)
WeakAuras.ClearAndUpdateOptions(parentData.id)
parentButton:UpdateParentWarning()
end
end
OptionsPrivate.Private.ResumeAllDynamicGroups()
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
OptionsPrivate.SortDisplayButtons(nil, true)
end
end,
@@ -609,6 +614,13 @@ function WeakAuras.ToggleOptions(msg, Private)
-- The button does not yet exists if a new aura is created
displayButtons[id]:UpdateWarning()
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)
OptionsPrivate.Private.callbacks:RegisterCallback("ScanForLoads", AfterScanForLoads)
@@ -735,16 +747,16 @@ local function LayoutDisplayButtons(msg)
frame.buttonsScroll:PerformLayout()
OptionsPrivate.SortDisplayButtons(msg);
OptionsPrivate.Private.PauseAllDynamicGroups();
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
if (WeakAuras.IsOptionsOpen()) then
for id, button in pairs(displayButtons) do
if(OptionsPrivate.Private.loaded[id] ~= nil) then
if OptionsPrivate.Private.loaded[id] then
button:PriorityShow(1);
end
end
WeakAuras.OptionsFrame().loadedButton:RecheckVisibility()
end
OptionsPrivate.Private.ResumeAllDynamicGroups();
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
frame:SetLoadProgressVisible(false)
end
@@ -823,11 +835,11 @@ function WeakAuras.ShowOptions(msg)
if not(firstLoad) then
-- Show what was last shown
OptionsPrivate.Private.PauseAllDynamicGroups();
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
for id, button in pairs(displayButtons) do
button:SyncVisibility()
end
OptionsPrivate.Private.ResumeAllDynamicGroups();
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
end
if (frame.pickedDisplay) then
@@ -902,11 +914,12 @@ function OptionsPrivate.ConvertDisplay(data, newType)
local visibility = displayButtons[id]:GetVisibility();
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.Convert(data, newType);
displayButtons[id]:SetViewRegion(WeakAuras.regions[id].region);
displayButtons[id]:Initialize();
displayButtons[id]:PriorityShow(visibility);
frame:ClearOptions(id)
@@ -1096,23 +1109,51 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
tinsert(frame.buttonsScroll.children, frame.loadedButton);
local aurasMatchingFilter = {}
local useTextFilter = filter and filter ~= ""
local useTextFilter = filter ~= ""
local filterTable = OptionsPrivate.Private.splitAtOr(filter)
local topLevelLoadedAuras = {}
local topLevelUnloadedAuras = {}
local visible = {}
for id, child in pairs(displayButtons) do
if(OptionsPrivate.Private.loaded[id]) then
child:EnableLoaded();
if child.data.controlledChildren then
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
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
if useTextFilter then
if(id:lower():find(filter, 1, true)) then
aurasMatchingFilter[id] = true
for parent in OptionsPrivate.Private.TraverseParents(child.data) do
aurasMatchingFilter[parent.id] = true
for _, word in ipairs(filterTable) do
if(id:lower():find(word, 1, true)) then
aurasMatchingFilter[id] = true
for parent in OptionsPrivate.Private.TraverseParents(child.data) do
aurasMatchingFilter[parent.id] = true
end
end
end
else
@@ -1121,7 +1162,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
if not child:GetGroup() then
-- Top Level aura
if OptionsPrivate.Private.loaded[child.data.id] ~= nil then
if OptionsPrivate.Private.loaded[id] ~= nil then
tinsert(topLevelLoadedAuras, id)
else
tinsert(topLevelUnloadedAuras, id)
@@ -1129,6 +1170,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
end
end
wipe(frame.loadedButton.childButtons)
if frame.loadedButton:GetExpanded() then
table.sort(topLevelLoadedAuras)
for _, id in ipairs(topLevelLoadedAuras) do
@@ -1138,8 +1180,15 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
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);
wipe(frame.unloadedButton.childButtons)
if frame.unloadedButton:GetExpanded() then
table.sort(topLevelUnloadedAuras)
for _, id in ipairs(topLevelUnloadedAuras) do
@@ -1149,6 +1198,12 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
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
if(not visible[child]) then
child.frame:Hide();
@@ -1290,9 +1345,6 @@ function OptionsPrivate.AddDisplayButton(data)
EnsureDisplayButton(data);
WeakAuras.UpdateThumbnail(data);
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
function OptionsPrivate.StartGrouping(data)
@@ -1462,6 +1514,7 @@ function OptionsPrivate.Drop(mainAura, target, action, area)
OptionsPrivate.SortDisplayButtons()
OptionsPrivate.UpdateButtonsScroll()
WeakAuras.FillOptions()
end
function OptionsPrivate.StartDrag(mainAura)
@@ -1506,6 +1559,7 @@ function OptionsPrivate.StartDrag(mainAura)
end
end
end
OptionsPrivate.UpdateButtonsScroll()
end
function OptionsPrivate.DropIndicator()
@@ -1619,6 +1673,7 @@ function OptionsPrivate.ResetMoverSizer()
end
function WeakAuras.SetMoverSizer(id)
OptionsPrivate.Private.EnsureRegion(id)
if WeakAuras.regions[id].region.toShow then
frame.moversizer:SetToRegion(WeakAuras.regions[id].region, db.displays[id])
else
@@ -1692,6 +1747,7 @@ function WeakAuras.NewAura(sourceData, regionType, targetId)
WeakAuras.UpdateGroupOrders(group.data);
OptionsPrivate.ClearOptions(group.data.id);
group.callbacks.UpdateExpandButton();
group:UpdateParentWarning();
group:Expand();
group:ReloadTooltip();
OptionsPrivate.PickAndEditDisplay(data.id);
+1 -1
View File
@@ -1,7 +1,7 @@
## Interface: 30300
## Title: WeakAuras Options
## Author: The WeakAuras Team
## Version: 4.1.1
## Version: 4.1.2
## Notes: Options for WeakAuras
## Notes-esES: Opciones para WeakAuras
## Notes-deDE: Optionen für WeakAuras