From 073ca1ffe39039785d2d5a17a716312b90c3db90 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sat, 8 Aug 2020 15:48:17 +0300 Subject: [PATCH] beta --- WeakAuras/Animations.lua | 2 +- WeakAuras/Media/Textures/gear.tga | Bin 0 -> 5299 bytes WeakAuras/Media/Textures/geardown.tga | Bin 0 -> 8401 bytes WeakAuras/RegionTypes/DynamicGroup.lua | 8 +- WeakAuras/WeakAuras.lua | 3 + .../AceGUIWidget-WeakAurasExpandAnchor.lua | 71 +++++ .../AceGUIWidget-WeakAurasExpandSmall.lua | 281 +++++++++++------- WeakAurasOptions/LoadOptions.lua | 25 +- WeakAurasOptions/RegionOptions/Icon.lua | 19 +- WeakAurasOptions/RegionOptions/Text.lua | 20 +- WeakAurasOptions/SubRegionOptions/Glow.lua | 20 +- WeakAurasOptions/SubRegionOptions/SubText.lua | 42 ++- WeakAurasOptions/SubRegionOptions/Tick.lua | 20 +- WeakAurasOptions/WeakAurasOptions.lua | 26 +- WeakAurasOptions/WeakAurasOptions.toc | 1 + 15 files changed, 406 insertions(+), 132 deletions(-) create mode 100644 WeakAuras/Media/Textures/gear.tga create mode 100644 WeakAuras/Media/Textures/geardown.tga create mode 100644 WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasExpandAnchor.lua 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 0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&I<<16~zhxZsp*e!+rL(~uhjf;Db=`~Y zv?txD&kedkAzy8K=JFCrJAa6+dHYh031Le}hYSh9kWAPHKQG)F*3A`!`;j4?x<*cJ zPFW9C!JknJkTx$Q{U<;F!Eq>k$*b@{)Oyr$;kl-6#=Vd=Z5IWmdqg?{ z=i=$aAA5GRk9T`4FV1cH=3q-T`kid=qJ~qfo>TBb$lqz(jt@=xjHWe|c0))NiDj76 zFWexe{@p7=uVh1dhK#e4Ur!Xh`~VfYbRXfhgdDNJ8DAGV=8T|@=OY+FA@aM0u8l_h zAj+?-iDgY4?p7aR{sVeg23x`9dOOZz9N7kLlz#6EwK%|AzVOI+*D@@*6>nRH z!)^!W&2UVA7PyT;$cmMzZ literal 0 HcmV?d00001 diff --git a/WeakAuras/Media/Textures/geardown.tga b/WeakAuras/Media/Textures/geardown.tga new file mode 100644 index 0000000000000000000000000000000000000000..d792527d0a4eda8bc7759056395c7982c03b372c GIT binary patch literal 8401 zcmeI1d9amb9e~fh7q|!_i*f}51R25=1rbw|3}S0gOcW8EaWoVu11nqH(#tNQk%EGP zONcg(sZD}NASfBGU>Yu@K_V@k1b51VT zAeaAle(wBSyZRGrYHD&b94pSfRnrzOhm#(1IOguk*1uJgD`%o;lHDR&4PcZ*H6>iu z!fY4@Eg$ga30~snI*c`j9&k5&7mk>q991f-7c3voC1kCjaToN5()*IEJH4Znv3hVi z+zNYPKfD0lAvZoRw~XE+P;n=h8Z|9~>*2_$N#;aX>xpvP!Dv_vhoBm2YTNJgS9^-b zd51P%4O=xcJa~yl*Rjq`Ny5WLoo@w$U;%7_>Tz7cq*XMAL(_6^&4=RzMwU%+jf$2- z_b_ylqQ`p)D~y8+RB;a650wzMM>O^70K5i6pe}evdvL*lq+}btmXWP-NlCb)aBtHl z1HKZfCUc3=H8iHdESL+HLG@TJ;hjO510Sd>6tAZ7^?UTS{BSkaP$PH@%xM;)oUI95 z;^u=i_J=49+5-ciq0;!<6W$HgdiVzPp6X2Ik1fZoh{_1Rj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Ru&OF24eaSJ8vXx*_N2m&FLRWg- zH#eV5;gTxABzTLKHU>qkgY1K;)un1{#hgwDccayoJ%d7i{Gt};j=r1*3zL%N^iFbl zZQxvSJm~D!NV39IvIQ1^=U%Ij7Q(0a<`WKiYbTg*C?n?EX^c$A+|l$D`+2$Zb-Cni zUrc*6w1?6V9lxu_FPM7nnKu$V0kSVMO@lRJ8d^tXl+se>)$lPGbWac?=F3O+!V_}i z*H-1az8{#Ww>2&5)Koc|ot(OFUaoPz;Eas2QcKSArwiQxSmXPAkY+npsPGV}k-|2zVvxwg5DrA=~Y<(mDsx^B2?= 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