diff --git a/WeakAuras/Animations.lua b/WeakAuras/Animations.lua index d419256..5bda8ba 100644 --- a/WeakAuras/Animations.lua +++ b/WeakAuras/Animations.lua @@ -71,7 +71,7 @@ local function UpdateAnimations() end local progress = anim.inverse and (1 - anim.progress) or anim.progress; progress = anim.easeFunc(progress, anim.easeStrength or 3) - WeakAuras.ActivateAuraEnvironment(anim.region) + WeakAuras.ActivateAuraEnvironmentForRegion(anim.region) if(anim.translateFunc) then if (anim.region.SetOffsetAnim) then local ok, x, y = pcall(anim.translateFunc, progress, 0, 0, anim.dX, anim.dY); diff --git a/WeakAuras/Media/Textures/gear.tga b/WeakAuras/Media/Textures/gear.tga new file mode 100644 index 0000000..994251f Binary files /dev/null and b/WeakAuras/Media/Textures/gear.tga differ diff --git a/WeakAuras/Media/Textures/geardown.tga b/WeakAuras/Media/Textures/geardown.tga new file mode 100644 index 0000000..d792527 Binary files /dev/null and b/WeakAuras/Media/Textures/geardown.tga differ diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 1c568bc..253d304 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -1039,15 +1039,15 @@ local function modify(parent, region, data) function region:DoPositionChildrenPerFrame(frame, positions, handledRegionData) for regionData, pos in pairs(positions) do + if type(regionData) ~= "table" then + break; + end handledRegionData[regionData] = true local x, y, show = type(pos[1]) == "number" and pos[1] or 0, type(pos[2]) == "number" and pos[2] or 0, type(pos[3]) ~= "boolean" and true or pos[3] - local controlPoint = type(regionData) == "table" and regionData.controlPoint - if not controlPoint then - break - end + local controlPoint = regionData.controlPoint controlPoint:ClearAnchorPoint() controlPoint:SetAnchorPoint( data.selfPoint, diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 88f0c67..09bf1c8 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -3462,6 +3462,9 @@ function WeakAuras.GetTriggerStateForTrigger(id, triggernum) return triggerState[id][triggernum]; end +function WeakAuras.GetActiveTriggers(id) + return triggerState[id].triggers +end do local visibleFakeStates = {} diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua new file mode 100644 index 0000000..e5862f2 --- /dev/null +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua @@ -0,0 +1,71 @@ +--[[----------------------------------------------------------------------------- +Anchor for a Expandable section +-------------------------------------------------------------------------------]] +local Type, Version = "WeakAurasExpandAnchor", 1 +local AceGUI = LibStub and LibStub("AceGUI-3.0", true) +if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end + +local methods = { + ["OnAcquire"] = function(self) + self:SetHeight(1) + self:SetWidth(1) + end, + + -- ["OnRelease"] = nil, + + ["OnWidthSet"] = function(self, width) + end, + + ["SetText"] = function(self, text) + end, + + ["SetFontObject"] = function(self, font) + end, +} + +local function OnFrameShow(frame) + local self = frame.obj + local option = self.userdata.option + if option and option.arg and option.arg.expanderName then + WeakAuras.expanderAnchors[option.arg.expanderName] = self + local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName] + if otherWidget then + otherWidget:SetAnchor(self) + end + end +end + +local function OnFrameHide(frame) + local self = frame.obj + local option = self.userdata.option + if option and option.arg and option.arg.expanderName then + WeakAuras.expanderAnchors[option.arg.expanderName] = nil + + local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName] + if otherWidget then + otherWidget:SetAnchor(nil) + end + end +end + + +local function Constructor() + local frame = CreateFrame("Frame", nil, UIParent) + frame:Hide() + + frame:SetScript("OnShow", OnFrameShow) + frame:SetScript("OnHide", OnFrameHide) + + -- create widget + local widget = { + frame = frame, + type = Type + } + for method, func in pairs(methods) do + widget[method] = func + end + + return AceGUI:RegisterAsWidget(widget) +end + +AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua index 958ac9e..0eaa169 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandSmall.lua @@ -18,139 +18,218 @@ local CreateFrame, UIParent = CreateFrame, UIParent Scripts -------------------------------------------------------------------------------]] local function Control_OnEnter(frame) - frame.obj:Fire("OnEnter") + frame.obj:Fire("OnEnter") end local function Control_OnLeave(frame) - frame.obj:Fire("OnLeave") + frame.obj:Fire("OnLeave") end local function Button_OnClick(frame, button) - frame.obj:Fire("OnClick", button) - AceGUI:ClearFocus() + frame.obj:Fire("OnClick", button) + AceGUI:ClearFocus() end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - self:SetHeight(20) - self:SetWidth(110) - self:SetLabel() - self:SetImage(nil) - self:SetImageSize(24, 24) - self:SetDisabled(false) - end, + ["OnAcquire"] = function(self) + self:SetHeight(20) + self:SetWidth(110) + self:SetLabel() + self:SetImage(nil) + self:SetImageSize(24, 24) + self:SetDisabled(false) + end, - -- ["OnRelease"] = nil, + -- ["OnRelease"] = nil, - ["SetLabel"] = function(self, text) - if text and text ~= "" then - self.label:Show() - self.label:SetText(text) - self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) - else - self.label:Hide() - self:SetHeight(self.image:GetHeight()) - end - end, + ["SetLabel"] = function(self, text) + if text and text ~= "" then + self.label:Show() + self.label:SetText(text) + self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) + else + self.label:Hide() + self:SetHeight(self.image:GetHeight()) + end + end, - ["SetImage"] = function(self, path, ...) - local image = self.image - image:SetTexture(path) + ["SetImage"] = function(self, path, ...) + local image = self.image + if path == "collapsed" then + self:SetExpandedState(false) + path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\gear" + elseif path == "expanded" then + self:SetExpandedState(true) + path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\geardown" + else + self:SetExpandedState(false) + end + image:SetTexture(path) - if image:GetTexture() then - local n = select("#", ...) - if n == 4 or n == 8 then - image:SetTexCoord(...) - else - image:SetTexCoord(0, 1, 0, 1) - end - end - end, + if image:GetTexture() then + local n = select("#", ...) + if n == 4 or n == 8 then + image:SetTexCoord(...) + else + image:SetTexCoord(0, 1, 0, 1) + end + end + end, - ["SetImageSize"] = function(self, width, height) - self.image:SetWidth(width) - self.image:SetHeight(height) - --self.frame:SetWidth(width + 30) - self:UpdateWidth() - if self.label:IsShown() then - self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) - else - self:SetHeight(self.image:GetHeight()) - end - end, + ["SetExpandedState"] = function(self, state) + self.expanded = state + if state then + self.expandedBackground:Show() + self.expandedHighlight:Show() + else + self.expandedBackground:Hide() + self.expandedHighlight:Hide() + end + end, - ["SetDisabled"] = function(self, disabled) - self.disabled = disabled - if disabled then - self.frame:Disable() - self.label:SetTextColor(0.5, 0.5, 0.5) - self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) - else - self.frame:Enable() - self.label:SetTextColor(1, 1, 1) - self.image:SetVertexColor(1, 1, 1, 1) - end - end, + ["GetExpandedState"] = function(self) + return self.expanded + end, - ["OnWidthSet"] = function(self, width) - self:UpdateWidth() - end, + ["SetImageSize"] = function(self, width, height) + self.image:SetWidth(width) + self.image:SetHeight(height) + self:UpdateWidth() + if self.label:IsShown() then + self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) + else + self:SetHeight(self.image:GetHeight()) + end + end, - ["UpdateWidth"] = function(self) - self.label:SetWidth(self.frame:GetWidth() - self.image:GetWidth()) - if self.label:IsShown() then - self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight())) - else - self:SetHeight(self.image:GetHeight()) - end - end + ["SetDisabled"] = function(self, disabled) + self.disabled = disabled + if disabled then + self.frame:Disable() + self.label:SetTextColor(0.5, 0.5, 0.5) + self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) + else + self.frame:Enable() + self.label:SetTextColor(1, 1, 1) + self.image:SetVertexColor(1, 1, 1, 1) + end + end, + + ["OnWidthSet"] = function(self, width) + self:UpdateWidth() + end, + + ["UpdateWidth"] = function(self) + self.label:SetWidth(self.frame:GetWidth() - self.image:GetWidth()) + if self.label:IsShown() then + self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight(), 20)) + else + self:SetHeight(self.image:GetHeight()) + end + self.expandedBackground:SetHeight(self.frame:GetHeight()*2) + end, + + ["SetAnchor"] = function(self, otherWidget) + local expandedBackground = self.expandedBackground + if otherWidget then + expandedBackground:SetPoint("BOTTOMLEFT", otherWidget.frame, "TOPLEFT", -4, -2) + end + end } +local function OnFrameShow(frame) + local self = frame.obj + local option = self.userdata.option + if option and option.arg and option.arg.expanderName then + WeakAuras.expanderButtons[option.arg.expanderName] = self + + local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName] + if otherWidget then + self:SetAnchor(otherWidget) + end + end +end + +local function OnFrameHide(frame) + local self = frame.obj + local option = self.userdata.option + if option and option.arg and option.arg.expanderName then + WeakAuras.expanderButtons[option.arg.expanderName] = nil + + local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName] + if otherWidget then + self:SetAnchor(nil) + end + end +end + + + + --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local function Constructor() - local frame = CreateFrame("Button", nil, UIParent) - frame:Hide() + local frame = CreateFrame("Button", nil, UIParent) + frame:Hide() - frame:EnableMouse(true) - frame:SetScript("OnEnter", Control_OnEnter) - frame:SetScript("OnLeave", Control_OnLeave) - frame:SetScript("OnClick", Button_OnClick) + frame:EnableMouse(true) + frame:SetScript("OnEnter", Control_OnEnter) + frame:SetScript("OnLeave", Control_OnLeave) + frame:SetScript("OnClick", Button_OnClick) + frame:SetScript("OnShow", OnFrameShow) + frame:SetScript("OnHide", OnFrameHide) - local image = frame:CreateTexture(nil, "BACKGROUND") - image:SetWidth(64) - image:SetHeight(64) - image:SetPoint("RIGHT", 0, 0) + local image = frame:CreateTexture(nil, "BACKGROUND") + image:SetWidth(64) + image:SetHeight(64) + image:SetPoint("LEFT", 2, 0) - local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") - label:SetJustifyH("LEFT") - label:SetJustifyV("CENTER") - label:SetPoint("RIGHT", image, "LEFT", -5, 0) - label:SetPoint("TOP") - label:SetPoint("BOTTOM") - label:SetPoint("LEFT") + local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") + label:SetJustifyH("LEFT") + label:SetJustifyV("CENTER") + label:SetPoint("RIGHT") + label:SetPoint("TOP") + label:SetPoint("BOTTOM") + label:SetPoint("LEFT", image, "RIGHT", 5, 0) - local highlight = frame:CreateTexture(nil, "HIGHLIGHT") - highlight:SetAllPoints(frame) - highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") - highlight:SetVertexColor(0.2, 0.4, 0.8, 0.2) - highlight:SetBlendMode("ADD") + local highlight = frame:CreateTexture(nil, "HIGHLIGHT") + highlight:SetAllPoints(frame) + highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") + highlight:SetVertexColor(0.2, 0.4, 0.8, 0.2) + highlight:SetBlendMode("ADD") - local widget = { - label = label, - image = image, - frame = frame, - type = Type - } - for method, func in pairs(methods) do - widget[method] = func - end + local expandedHighlight = frame:CreateTexture(nil, "BACKGROUND") + expandedHighlight:SetPoint("TOPLEFT", frame, -2, 0) + expandedHighlight:SetPoint("BOTTOMRIGHT", frame, 0, 0) + expandedHighlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White") + expandedHighlight:SetVertexColor(1, 0.8, 0, 0.1) + expandedHighlight:SetBlendMode("ADD") - return AceGUI:RegisterAsWidget(widget) + local expandedBackground = frame:CreateTexture(nil, "BACKGROUND") + expandedBackground:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", -1, -1) + expandedBackground:SetWidth(128) + expandedBackground:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_AlphaGradient") + expandedBackground:SetVertexColor(1, 0.8, 0, 0.15) + expandedBackground:SetBlendMode("ADD") + + local widget = { + label = label, + image = image, + frame = frame, + type = Type, + expanded = false, + expandedBackground = expandedBackground, + expandedHighlight = expandedHighlight, + } + for method, func in pairs(methods) do + widget[method] = func + end + + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/LoadOptions.lua b/WeakAurasOptions/LoadOptions.lua index 7dcba22..154db06 100644 --- a/WeakAurasOptions/LoadOptions.lua +++ b/WeakAurasOptions/LoadOptions.lua @@ -93,6 +93,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri local order = startorder or 10; local isCollapsedFunctions; + local positionsForCollapseAnchor = {} for index, arg in pairs(prototype.args) do local hidden = nil; if(arg.collapse and isCollapsedFunctions[arg.collapse] and type(arg.enable) == "function") then @@ -104,6 +105,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri hidden = function() return not arg.enable(trigger) end; elseif(arg.collapse and isCollapsedFunctions[arg.collapse]) then hidden = isCollapsedFunctions[arg.collapse] + positionsForCollapseAnchor[arg.collapse] = order end local name = arg.name; local validate = arg.validate; @@ -117,16 +119,19 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri order = order, image = function() local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true) - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24, + imageWidth = 15, + imageHeight = 15, func = function(info, button, secondCall) if not secondCall then local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true) WeakAuras.SetCollapsed("trigger", name, "", not collapsed) end end, + arg = { + expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name + } } order = order + 1; @@ -905,7 +910,19 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri end end - WeakAuras.option = options; + for name, order in pairs(positionsForCollapseAnchor) do + options[name .. "anchor"] = { + type = "description", + name = "", + control = "WeakAurasExpandAnchor", + order = order + 0.5, + arg = { + expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name + }, + hidden = isCollapsedFunctions[name] + } + end + return options; end diff --git a/WeakAurasOptions/RegionOptions/Icon.lua b/WeakAurasOptions/RegionOptions/Icon.lua index d05e65e..23a79f9 100644 --- a/WeakAurasOptions/RegionOptions/Icon.lua +++ b/WeakAurasOptions/RegionOptions/Icon.lua @@ -94,14 +94,17 @@ local function createOptions(id, data) order = 7, image = function() local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true); - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24, + imageWidth = 15, + imageHeight = 15, func = function(info, button) local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true); WeakAuras.SetCollapsed("icon", "icon", "iconextra", not collapsed); end, + arg = { + expanderName = "icon" + } }, iconExtra_space1 = { type = "description", @@ -159,6 +162,16 @@ local function createOptions(id, data) order = 7.07, hidden = hiddenIconExtra, }, + iconExtraAnchor = { + type = "description", + name = "", + order = 8, + hidden = hiddenIconExtra, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "icon" + } + }, cooldownHeader = { type = "header", order = 11, diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index 28da2d9..196c99e 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -110,10 +110,13 @@ local function createOptions(id, data) end, image = function() local collapsed = WeakAuras.IsCollapsed("text", "text", "fontflags", true) - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24 + imageWidth = 15, + imageHeight = 15, + arg = { + expanderName = "text" + } }, text_font_space = { @@ -232,6 +235,17 @@ local function createOptions(id, data) hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end }, + fontExtraAnchor = { + type = "description", + name = "", + order = 50, + hidden = hiddenFontExtra, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "text" + } + }, + endHeader = { type = "header", order = 100, diff --git a/WeakAurasOptions/SubRegionOptions/Glow.lua b/WeakAurasOptions/SubRegionOptions/Glow.lua index 0e7417f..220b728 100644 --- a/WeakAurasOptions/SubRegionOptions/Glow.lua +++ b/WeakAurasOptions/SubRegionOptions/Glow.lua @@ -108,14 +108,17 @@ local function createOptions(parentData, data, index, subIndex) order = 4, image = function() local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true); - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24, + imageWidth = 15, + imageHeight = 15, func = function(info, button) local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true); WeakAuras.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed); end, + arg = { + expanderName = "glow" .. index .. "#" .. subIndex + } }, glow_space1 = { type = "description", @@ -245,6 +248,17 @@ local function createOptions(parentData, data, index, subIndex) name = L["Border"], order = 19, hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end, + }, + + glow_anchor = { + type = "description", + name = "", + order = 20, + hidden = hiddenGlowExtra, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "glow" .. index .. "#" .. subIndex + } } } return options diff --git a/WeakAurasOptions/SubRegionOptions/SubText.lua b/WeakAurasOptions/SubRegionOptions/SubText.lua index 9fc535b..479bad9 100644 --- a/WeakAurasOptions/SubRegionOptions/SubText.lua +++ b/WeakAurasOptions/SubRegionOptions/SubText.lua @@ -135,10 +135,13 @@ local function createOptions(parentData, data, index, subIndex) end, image = function() local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true) - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24 + imageWidth = 15, + imageHeight = 15, + arg = { + expanderName = "subtext" .. index .. "#" .. subIndex + } }, text_font_space = { @@ -256,6 +259,17 @@ local function createOptions(parentData, data, index, subIndex) values = WeakAuras.text_word_wrap, hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end }, + + text_anchor = { + type = "description", + name = "", + order = 55, + hidden = hiddenFontExtra, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "subtext" .. index .. "#" .. subIndex + } + } } -- Note: Anchor Options need to be generalized once there are multiple sub regions @@ -306,14 +320,17 @@ local function createOptions(parentData, data, index, subIndex) order = 60, image = function() local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true) - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24, + imageWidth = 15, + imageHeight = 15, func = function(info, button) local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true) WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed) - end + end, + arg = { + expanderName = "subtext_anchor" .. index .. "#" .. subIndex + } } @@ -380,6 +397,17 @@ local function createOptions(parentData, data, index, subIndex) hidden = hiddenFunction } + options.text_anchor_anchor = { + type = "description", + name = "", + order = 61, + hidden = hiddenFontExtra, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "subtext_anchor" .. index .. "#" .. subIndex + } + } + local function hideCustomTextOption() if not parentData.subRegions then return true diff --git a/WeakAurasOptions/SubRegionOptions/Tick.lua b/WeakAurasOptions/SubRegionOptions/Tick.lua index a1ba46e..f404d76 100644 --- a/WeakAurasOptions/SubRegionOptions/Tick.lua +++ b/WeakAurasOptions/SubRegionOptions/Tick.lua @@ -108,10 +108,13 @@ local function createOptions(parentData, data, index, subIndex) end, image = function() local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "tickextras" .. index, true) - return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return collapsed and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24 + imageWidth = 15, + imageHeight = 15, + arg = { + expanderName = "tick" .. index .. "#" .. subIndex + } }, automatic_length = { type = "toggle", @@ -209,6 +212,17 @@ local function createOptions(parentData, data, index, subIndex) softMax = 200, hidden = hiddentickextras, }, + + tick_anchor = { + type = "description", + name = "", + order = 18, + hidden = hiddentickextras, + control = "WeakAurasExpandAnchor", + arg = { + expanderName = "tick" .. index .. "#" .. subIndex + } + } } return options end diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index 821339d..c9a8e49 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -32,6 +32,9 @@ local spellCache = WeakAuras.spellCache; local savedVars = {}; WeakAuras.savedVars = savedVars; +WeakAuras.expanderAnchors = {} +WeakAuras.expanderButtons = {} + local tempGroup = { id = {"tempGroup"}, regionType = "group", @@ -1617,10 +1620,13 @@ function WeakAuras.AddTextFormatOption(input, withHeader, get, addOption, hidden setHidden(not hidden()) end, image = function() - return hidden() and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown" + return hidden() and "collapsed" or "expanded" end, - imageWidth = 24, - imageHeight = 24 + imageWidth = 15, + imageHeight = 15, + arg = { + expanderName = tostring(addOption) + } } addOption("header", headerOption) else @@ -1661,6 +1667,20 @@ function WeakAuras.AddTextFormatOption(input, withHeader, get, addOption, hidden end end) + if withHeader then + addOption("header_anchor", + { + type = "description", + name = "", + control = "WeakAurasExpandAnchor", + arg = { + expanderName = tostring(addOption) + } + } + + ) + end + if not next(seenSymbols) and withHeader then headerOption.hidden = true end diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 41efb54..56df2c6 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -85,3 +85,4 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua AceGUI-Widgets\AceGUIContainer-WeakAurasTreeGroup.lua AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua AceGUI-Widgets\AceGUIContainer-WeakAurasInlineGroup.lua +AceGUI-Widgets\AceGUIWidget-WeakAurasExpandAnchor.lua