From 45a92363905c675bc978899049aea43a96279e93 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Mon, 24 Nov 2014 19:06:22 +0400 Subject: [PATCH] Breaking moar shit --- ElvUI_SLE/defaults/profile.lua | 8 + ElvUI_SLE/modules/uibuttons.lua | 449 ++++++++++++++++++++++--------------- ElvUI_SLE/options/uibuttons_c.lua | 70 ++++++ 3 files changed, 352 insertions(+), 175 deletions(-) diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index bfc21bf..e02ceb9 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -426,6 +426,14 @@ P['sle'] = { ['mouse'] = false, ['position'] = "uib_vert", ['spacing'] = 3, + ['point'] = "TOPLEFT", + ['anchor'] = "TOPRIGHT", + ['xoffset'] = 0, + ['yoffset'] = 0, + ['roll'] = { + ['min'] = "1", + ['max'] = "50", + } }, ['rumouseover'] = false, diff --git a/ElvUI_SLE/modules/uibuttons.lua b/ElvUI_SLE/modules/uibuttons.lua index eae6b88..a670126 100644 --- a/ElvUI_SLE/modules/uibuttons.lua +++ b/ElvUI_SLE/modules/uibuttons.lua @@ -1,14 +1,16 @@ -local E, L, V, P, G = unpack(ElvUI); +local E, L, V, P, G = unpack(ElvUI); local UB = E:GetModule('SLE_UIButtons'); local ACD = LibStub("AceConfigDialog-3.0") +local SLE = E:GetModule("SLE") local Sk = E:GetModule("Skins") local BorderColor = E['media'].bordercolor -local NumBut = 5 +local NumBut = 4 local ToggleTable = {} local ConfigTable = {} local AddonTable = {} local StatusTable = {} +local RollTable = {} function UB:CreateFrame() UB.menuHolder = CreateFrame("Frame", "SLEUIButtonHolder", E.UIParent) @@ -16,10 +18,8 @@ function UB:CreateFrame() UB.menuHolder:SetFrameLevel(5) UB.menuHolder:SetClampedToScreen(true) UB.menuHolder:Point("LEFT", E.UIParent, "LEFT", -2, 0); - -- UB.menuHolder:CreateBackdrop() UB.menuHolder.Config = CreateFrame("Frame", "SLEUIConfigHolder", UB.menuHolder) - -- UB.menuHolder.Config:CreateBackdrop() UB.menuHolder.Config.Toggle = CreateFrame("Button", "SLEUIConfigToggle", UB.menuHolder) UB.menuHolder.Config.Toggle.text = UB.menuHolder.Config.Toggle:CreateFontString(nil, "OVERLAY") UB.menuHolder.Config.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") @@ -29,7 +29,6 @@ function UB:CreateFrame() Sk:HandleButton(UB.menuHolder.Config.Toggle) UB.menuHolder.Addon = CreateFrame("Frame", "SLEUIAddonHolder", UB.menuHolder) - -- UB.menuHolder.Addon:CreateBackdrop() UB.menuHolder.Addon.Toggle = CreateFrame("Button", "SLEUIAddonToggle", UB.menuHolder) UB.menuHolder.Addon.Toggle.text = UB.menuHolder.Addon.Toggle:CreateFontString(nil, "OVERLAY") UB.menuHolder.Addon.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") @@ -39,7 +38,6 @@ function UB:CreateFrame() Sk:HandleButton(UB.menuHolder.Addon.Toggle) UB.menuHolder.Status = CreateFrame("Frame", "SLEUIStatusHolder", UB.menuHolder) - -- UB.menuHolder.Status:CreateBackdrop() UB.menuHolder.Status.Toggle = CreateFrame("Button", "SLEUIStatusToggle", UB.menuHolder) UB.menuHolder.Status.Toggle.text = UB.menuHolder.Status.Toggle:CreateFontString(nil, "OVERLAY") UB.menuHolder.Status.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") @@ -48,10 +46,20 @@ function UB:CreateFrame() UB:StatusSetup() Sk:HandleButton(UB.menuHolder.Status.Toggle) + UB.menuHolder.Roll = CreateFrame("Frame", "SLEUIRollHolder", UB.menuHolder) + UB.menuHolder.Roll.Toggle = CreateFrame("Button", "SLEUIRollToggle", UB.menuHolder) + UB.menuHolder.Roll.Toggle.text = UB.menuHolder.Roll.Toggle:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Toggle.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Toggle.text:SetPoint("CENTER", UB.menuHolder.Roll.Toggle, "CENTER", 0, 0) + UB.menuHolder.Roll.Toggle.text:SetText("R") + UB:RollSetup() + Sk:HandleButton(UB.menuHolder.Roll.Toggle) + ToggleTable = { UB.menuHolder.Config.Toggle, UB.menuHolder.Addon.Toggle, UB.menuHolder.Status.Toggle, + UB.menuHolder.Roll.Toggle, } end @@ -71,13 +79,18 @@ function UB:ToggleCats() else UB.menuHolder.Status:Hide() end + if UB.menuHolder.Roll.Toggle.opened then + UB.menuHolder.Roll:Show() + else + UB.menuHolder.Roll:Hide() + end end function UB:ConfigSetup() local button = UB.menuHolder.Config.Toggle local db = E.db.sle.uibuttons button.opened = false - UB.menuHolder.Config:Point("TOP", button, "BOTTOM", 0, -4) + UB.menuHolder.Config:Hide() button:SetScript("OnClick", function(self) if self.opened then @@ -86,6 +99,7 @@ function UB:ConfigSetup() self.opened = true UB.menuHolder.Addon.Toggle.opened = false UB.menuHolder.Status.Toggle.opened = false + UB.menuHolder.Roll.Toggle.opened = false end UB:ToggleCats() end) @@ -94,15 +108,14 @@ function UB:ConfigSetup() UB.menuHolder.Config.Elv.text = UB.menuHolder.Config.Elv:CreateFontString(nil, "OVERLAY") UB.menuHolder.Config.Elv.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Config.Elv.text:SetPoint("CENTER", UB.menuHolder.Config.Elv, "CENTER") - UB.menuHolder.Config.Elv.text:SetText("Elv") + UB.menuHolder.Config.Elv.text:SetText("ElvUI") UB.menuHolder.Config.Elv:SetScript("OnClick", function(self) E:ToggleConfig() - -- ACD:SelectGroup("ElvUI", "general") --Do we need this? button.opened = false UB:ToggleCats() end) UB.menuHolder.Config.Elv:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) + GameTooltip:SetOwner(self) GameTooltip:AddLine(L["ElvUI Config"], .6, .6, .6, .6, .6, 1) GameTooltip:AddLine(L["Click to toggle config window"], 1, 1, 1, 1, 1, 1) GameTooltip:Show() @@ -125,7 +138,7 @@ function UB:ConfigSetup() UB:ToggleCats() end) UB.menuHolder.Config.SLE:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) + GameTooltip:SetOwner(self) GameTooltip:AddLine(L["S&L Config"], .6, .6, .6, .6, .6, 1) GameTooltip:AddLine(L["Click to toggle Shadow & Light config group"], 1, 1, 1, 1, 1, 1) GameTooltip:Show() @@ -136,16 +149,39 @@ function UB:ConfigSetup() Sk:HandleButton(UB.menuHolder.Config.SLE) end do + UB.menuHolder.Config.Benik = CreateFrame("Button", "SLEUIConfigBenik", UB.menuHolder.Config) + UB.menuHolder.Config.Benik.text = UB.menuHolder.Config.Benik:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Config.Benik.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Config.Benik.text:SetPoint("CENTER", UB.menuHolder.Config.Benik, "CENTER") + UB.menuHolder.Config.Benik.text:SetText("BenikUI") + UB.menuHolder.Config.Benik:SetScript("OnClick", function(self) + E:ToggleConfig() + ACD:SelectGroup("ElvUI", "bui") + button.opened = false + UB:ToggleCats() + end) + UB.menuHolder.Config.Benik:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self) + GameTooltip:AddLine(L["BenikUI Config"], .6, .6, .6, .6, .6, 1) + GameTooltip:AddLine(L["Click to toggle BenikUI config group"], 1, 1, 1, 1, 1, 1) + GameTooltip:Show() + end) + UB.menuHolder.Config.Benik:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + Sk:HandleButton(UB.menuHolder.Config.Benik) + end + do UB.menuHolder.Config.Reload = CreateFrame("Button", "SLEUIConfigReload", UB.menuHolder.Config) UB.menuHolder.Config.Reload.text = UB.menuHolder.Config.Reload:CreateFontString(nil, "OVERLAY") UB.menuHolder.Config.Reload.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Config.Reload.text:SetPoint("CENTER", UB.menuHolder.Config.Reload, "CENTER") - UB.menuHolder.Config.Reload.text:SetText("Reload UI") + UB.menuHolder.Config.Reload.text:SetText("/reload") UB.menuHolder.Config.Reload:SetScript("OnClick", function(self) ReloadUI() end) UB.menuHolder.Config.Reload:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) + GameTooltip:SetOwner(self) GameTooltip:AddLine(L["Reload UI"], .6, .6, .6, .6, .6, 1) GameTooltip:AddLine(L["Click to reload your interface"], 1, 1, 1, 1, 1, 1) GameTooltip:Show() @@ -160,14 +196,14 @@ function UB:ConfigSetup() UB.menuHolder.Config.MoveUI.text = UB.menuHolder.Config.MoveUI:CreateFontString(nil, "OVERLAY") UB.menuHolder.Config.MoveUI.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Config.MoveUI.text:SetPoint("CENTER", UB.menuHolder.Config.MoveUI, "CENTER") - UB.menuHolder.Config.MoveUI.text:SetText("Move UI") + UB.menuHolder.Config.MoveUI.text:SetText(L["Move"]) UB.menuHolder.Config.MoveUI:SetScript("OnClick", function(self) E:ToggleConfigMode() button.opened = false UB:ToggleCats() end) UB.menuHolder.Config.MoveUI:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) + GameTooltip:SetOwner(self) GameTooltip:AddLine(L["Move UI"], .6, .6, .6, .6, .6, 1) GameTooltip:AddLine(L["Click to unlock moving ElvUI elements"], 1, 1, 1, 1, 1, 1) GameTooltip:Show() @@ -178,33 +214,10 @@ function UB:ConfigSetup() Sk:HandleButton(UB.menuHolder.Config.MoveUI) end - do - UB.menuHolder.Config.Elv = CreateFrame("Button", "SLEUIConfigElv", UB.menuHolder.Config) - UB.menuHolder.Config.Elv.text = UB.menuHolder.Config.Elv:CreateFontString(nil, "OVERLAY") - UB.menuHolder.Config.Elv.text:SetFont(E["media"].normFont, 10, "OUTLINE") - UB.menuHolder.Config.Elv.text:SetPoint("CENTER", UB.menuHolder.Config.Elv, "CENTER") - UB.menuHolder.Config.Elv.text:SetText("Elv") - UB.menuHolder.Config.Elv:SetScript("OnClick", function(self) - E:ToggleConfig() - -- ACD:SelectGroup("ElvUI", "general") --Do we need this? - button.opened = false - UB:ToggleCats() - end) - UB.menuHolder.Config.Elv:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine(L["ElvUI Config"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle config window"], 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Config.Elv:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) - Sk:HandleButton(UB.menuHolder.Config.Elv) - end - ConfigTable = { UB.menuHolder.Config.Elv, UB.menuHolder.Config.SLE, + UB.menuHolder.Config.Benik, UB.menuHolder.Config.Reload, UB.menuHolder.Config.MoveUI, } @@ -213,7 +226,6 @@ end function UB:AddonSetup() local button = UB.menuHolder.Addon.Toggle button.opened = false - UB.menuHolder.Addon:Point("TOP", button, "BOTTOM", 0, -4) UB.menuHolder.Addon:Hide() button:SetScript("OnClick", function(self) if self.opened then @@ -222,6 +234,7 @@ function UB:AddonSetup() self.opened = true UB.menuHolder.Config.Toggle.opened = false UB.menuHolder.Status.Toggle.opened = false + UB.menuHolder.Roll.Toggle.opened = false end UB:ToggleCats() end) @@ -231,7 +244,7 @@ function UB:AddonSetup() UB.menuHolder.Addon.Manager.text = UB.menuHolder.Addon.Manager:CreateFontString(nil, "OVERLAY") UB.menuHolder.Addon.Manager.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Addon.Manager.text:SetPoint("CENTER", UB.menuHolder.Addon.Manager, "CENTER") - UB.menuHolder.Addon.Manager.text:SetText("Manager") + UB.menuHolder.Addon.Manager.text:SetText(L["Addons"]) UB.menuHolder.Addon.Manager:SetScript("OnClick", function(self) GameMenuButtonAddons:Click() button.opened = false @@ -264,7 +277,7 @@ function UB:AddonSetup() UB.menuHolder.Addon.Boss:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) GameTooltip:AddLine(L["Boss Mod"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine(L["Click to toggle the Configuration/Option Window from the Bossmod (DXE, DBM or Bigwigs) you have enabled."], 1, 1, 1, 1, 1, 1) + GameTooltip:AddLine(L["Click to toggle the Configuration/Option Window from the Bossmod you have enabled."], 1, 1, 1, 1, 1, 1) GameTooltip:Show() end) UB.menuHolder.Addon.Boss:SetScript("OnLeave", function(self) @@ -274,12 +287,12 @@ function UB:AddonSetup() UB.menuHolder.Addon.bossmode = function() end if IsAddOnLoaded("DBM-Core") then UB.menuHolder.Addon.bossmode = function() DBM:LoadGUI() end - elseif IsAddOnLoaded("Bigwigs") then - UB.menuHolder.Addon.bossmode = function() end + -- elseif IsAddOnLoaded("Bigwigs") then + -- UB.menuHolder.Addon.bossmode = function() end elseif IsAddOnLoaded("VEM-Core") then UB.menuHolder.Addon.bossmode = function() VEM:LoadGUI() end - elseif IsAddOnLoaded("DXE_Loader") then - UB.menuHolder.Addon.bossmode = function() end + -- elseif IsAddOnLoaded("DXE_Loader") then + -- UB.menuHolder.Addon.bossmode = function() end -- elseif IsAddOnLoaded("") then -- UB.menuHolder.Addon.bossmode = function() end else @@ -300,15 +313,6 @@ function UB:AddonSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Addon.Altoholic:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine("Altoholic", .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Call Altoholic", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.Altoholic:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) if IsAddOnLoaded("Altoholic") then UB.menuHolder.Addon.Altoholic.shown = true else @@ -328,15 +332,6 @@ function UB:AddonSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Addon.AtlasLoot:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine("AtlasLoot", .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Call AtlasLoot", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.AtlasLoot:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) if IsAddOnLoaded("AtlasLoot_Loader") then UB.menuHolder.Addon.AtlasLoot.shown = true else @@ -357,15 +352,6 @@ function UB:AddonSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Addon.WeakAuras:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine("WeakAuras", .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Call WeakAuras", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.WeakAuras:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) if IsAddOnLoaded("WeakAuras") then UB.menuHolder.Addon.WeakAuras.shown = true else @@ -375,6 +361,26 @@ function UB:AddonSetup() tinsert(AddonTable, UB.menuHolder.Addon.WeakAuras) end + do + UB.menuHolder.Addon.Swatter = CreateFrame("Button", "SLEUIAddonSwatter", UB.menuHolder.Addon) + UB.menuHolder.Addon.Swatter.text = UB.menuHolder.Addon.Swatter:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Addon.Swatter.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Addon.Swatter.text:SetPoint("CENTER", UB.menuHolder.Addon.Swatter, "CENTER") + UB.menuHolder.Addon.Swatter.text:SetText("Swatter") + UB.menuHolder.Addon.Swatter:SetScript("OnClick", function(self) + Swatter.ErrorShow() + button.opened = false + UB:ToggleCats() + end) + if IsAddOnLoaded("!Swatter") then + UB.menuHolder.Addon.Swatter.shown = true + else + UB.menuHolder.Addon.Swatter.shown = false + end + Sk:HandleButton(UB.menuHolder.Addon.Swatter) + tinsert(AddonTable, UB.menuHolder.Addon.Swatter) + end + --Always keep at the bottom-- do UB.menuHolder.Addon.WowLua = CreateFrame("Button", "SLEUIAddonWowLua", UB.menuHolder.Addon) @@ -387,15 +393,6 @@ function UB:AddonSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Addon.WowLua:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine("WowLua", .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Call WowLua", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.WowLua:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) if IsAddOnLoaded("WowLua") then UB.menuHolder.Addon.WowLua.shown = true else @@ -411,20 +408,10 @@ function UB:AddonSetup() UB.menuHolder.Addon.Darth.text:SetPoint("CENTER", UB.menuHolder.Addon.Darth, "CENTER") UB.menuHolder.Addon.Darth.text:SetText("DarthUI") UB.menuHolder.Addon.Darth:SetScript("OnClick", function(self) - -- SlashCmdList["Darth"]("") DarthUI[1]:ToggleConfig() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Addon.Darth:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine("DarthUI", .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Çäðàñüòå, Ïîâåëèòåëü!", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Addon.Darth:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) if IsAddOnLoaded("DarthUI") then UB.menuHolder.Addon.Darth.shown = true else @@ -448,13 +435,13 @@ function UB:StatusSetup() self.opened = true UB.menuHolder.Config.Toggle.opened = false UB.menuHolder.Addon.Toggle.opened = false + UB.menuHolder.Roll.Toggle.opened = false end UB:ToggleCats() end) do UB.menuHolder.Status.AFK = CreateFrame("Button", "SLEUIStatusAFK", UB.menuHolder.Status) - UB.menuHolder.Status.AFK:Point("TOP", UB.menuHolder.Status, "TOP", 0, 0) UB.menuHolder.Status.AFK.text = UB.menuHolder.Status.AFK:CreateFontString(nil, "OVERLAY") UB.menuHolder.Status.AFK.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Status.AFK.text:SetPoint("CENTER", UB.menuHolder.Status.AFK, "CENTER") @@ -464,21 +451,11 @@ function UB:StatusSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Status.AFK:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine(L["AFK"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Àáûð", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Status.AFK:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) Sk:HandleButton(UB.menuHolder.Status.AFK) end do UB.menuHolder.Status.DND = CreateFrame("Button", "SLEUIStatusDND", UB.menuHolder.Status) - UB.menuHolder.Status.DND:Point("TOP", UB.menuHolder.Status.AFK, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) UB.menuHolder.Status.DND.text = UB.menuHolder.Status.DND:CreateFontString(nil, "OVERLAY") UB.menuHolder.Status.DND.text:SetFont(E["media"].normFont, 10, "OUTLINE") UB.menuHolder.Status.DND.text:SetPoint("CENTER", UB.menuHolder.Status.DND, "CENTER") @@ -488,15 +465,6 @@ function UB:StatusSetup() button.opened = false UB:ToggleCats() end) - UB.menuHolder.Status.DND:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_TOP", 30,0) - GameTooltip:AddLine(L["DND"], .6, .6, .6, .6, .6, 1) - GameTooltip:AddLine("Àáûð", 1, 1, 1, 1, 1, 1) - GameTooltip:Show() - end) - UB.menuHolder.Status.DND:SetScript("OnLeave", function(self) - GameTooltip:Hide() - end) Sk:HandleButton(UB.menuHolder.Status.DND) end @@ -506,6 +474,126 @@ function UB:StatusSetup() } end +function UB:RollSetup() + local button = UB.menuHolder.Roll.Toggle + local db = E.db.sle.uibuttons + button.opened = false + UB.menuHolder.Roll:Point("TOP", button, "BOTTOM", 0, -4) + UB.menuHolder.Roll:Hide() + button:SetScript("OnClick", function(self) + if self.opened then + self.opened = false + else + self.opened = true + UB.menuHolder.Config.Toggle.opened = false + UB.menuHolder.Addon.Toggle.opened = false + UB.menuHolder.Status.Toggle.opened = false + end + UB:ToggleCats() + end) + + do + UB.menuHolder.Roll.Ten = CreateFrame("Button", "SLEUIRollTen", UB.menuHolder.Roll) + UB.menuHolder.Roll.Ten.text = UB.menuHolder.Roll.Ten:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Ten.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Ten.text:SetPoint("CENTER", UB.menuHolder.Roll.Ten, "CENTER") + UB.menuHolder.Roll.Ten.text:SetText("1-10") + UB.menuHolder.Roll.Ten:SetScript("OnClick", function(self) + RandomRoll(1, 10) + button.opened = false + UB:ToggleCats() + end) + Sk:HandleButton(UB.menuHolder.Roll.Ten) + end + do + UB.menuHolder.Roll.Twenty = CreateFrame("Button", "SLEUIRollTwenty", UB.menuHolder.Roll) + UB.menuHolder.Roll.Twenty.text = UB.menuHolder.Roll.Twenty:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Twenty.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Twenty.text:SetPoint("CENTER", UB.menuHolder.Roll.Twenty, "CENTER") + UB.menuHolder.Roll.Twenty.text:SetText("1-20") + UB.menuHolder.Roll.Twenty:SetScript("OnClick", function(self) + RandomRoll(1, 20) + button.opened = false + UB:ToggleCats() + end) + Sk:HandleButton(UB.menuHolder.Roll.Twenty) + end + do + UB.menuHolder.Roll.Thirty = CreateFrame("Button", "SLEUIRollThirty", UB.menuHolder.Roll) + UB.menuHolder.Roll.Thirty.text = UB.menuHolder.Roll.Thirty:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Thirty.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Thirty.text:SetPoint("CENTER", UB.menuHolder.Roll.Thirty, "CENTER") + UB.menuHolder.Roll.Thirty.text:SetText("1-30") + UB.menuHolder.Roll.Thirty:SetScript("OnClick", function(self) + RandomRoll(1, 30) + button.opened = false + UB:ToggleCats() + end) + Sk:HandleButton(UB.menuHolder.Roll.Thirty) + end + do + UB.menuHolder.Roll.Forty = CreateFrame("Button", "SLEUIRollForty", UB.menuHolder.Roll) + UB.menuHolder.Roll.Forty.text = UB.menuHolder.Roll.Forty:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Forty.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Forty.text:SetPoint("CENTER", UB.menuHolder.Roll.Forty, "CENTER") + UB.menuHolder.Roll.Forty.text:SetText("1-40") + UB.menuHolder.Roll.Forty:SetScript("OnClick", function(self) + RandomRoll(1, 40) + button.opened = false + UB:ToggleCats() + end) + Sk:HandleButton(UB.menuHolder.Roll.Forty) + end + do + UB.menuHolder.Roll.Hundred = CreateFrame("Button", "SLEUIRollHundred", UB.menuHolder.Roll) + UB.menuHolder.Roll.Hundred.text = UB.menuHolder.Roll.Hundred:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Hundred.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Hundred.text:SetPoint("CENTER", UB.menuHolder.Roll.Hundred, "CENTER") + UB.menuHolder.Roll.Hundred.text:SetText("1-100") + UB.menuHolder.Roll.Hundred:SetScript("OnClick", function(self) + RandomRoll(1, 100) + button.opened = false + UB:ToggleCats() + end) + Sk:HandleButton(UB.menuHolder.Roll.Hundred) + end + do + UB.menuHolder.Roll.Custom = CreateFrame("Button", "SLEUIRollCustom", UB.menuHolder.Roll) + UB.menuHolder.Roll.Custom.text = UB.menuHolder.Roll.Custom:CreateFontString(nil, "OVERLAY") + UB.menuHolder.Roll.Custom.text:SetFont(E["media"].normFont, 10, "OUTLINE") + UB.menuHolder.Roll.Custom.text:SetPoint("CENTER", UB.menuHolder.Roll.Custom, "CENTER") + UB.menuHolder.Roll.Custom.text:SetText(L["Custom"]) + UB.menuHolder.Roll.Custom:SetScript("OnClick", function(self) + local min, max = tonumber(E.db.sle.uibuttons.roll.min), tonumber(E.db.sle.uibuttons.roll.max) + if min <= max then + RandomRoll(min, max) + else + SLE:Print(L["Custom roll limits are set incorrectly! Minimum should be smaller then or equial to maximum."]) + end + button.opened = false + UB:ToggleCats() + end) + UB.menuHolder.Roll.Custom:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self) + GameTooltip:AddLine(L["Do a roll with custom limits. Those limits can be set in S&L config."], .6, .6, .6, .6, .6, 1) + GameTooltip:Show() + end) + UB.menuHolder.Roll.Custom:SetScript("OnLeave", function(self) + GameTooltip:Hide() + end) + Sk:HandleButton(UB.menuHolder.Roll.Custom) + end + + RollTable = { + UB.menuHolder.Roll.Ten, + UB.menuHolder.Roll.Twenty, + UB.menuHolder.Roll.Thirty, + UB.menuHolder.Roll.Forty, + UB.menuHolder.Roll.Hundred, + UB.menuHolder.Roll.Custom, + } +end + function UB:MoverSize() local db = E.db.sle.uibuttons if db.position == "uib_vert" then @@ -517,7 +605,7 @@ function UB:MoverSize() end end -function UB:FrameSize() +function UB:FrameSize(onLoad) local db = E.db.sle.uibuttons UB:MoverSize() @@ -528,7 +616,6 @@ function UB:FrameSize() for i = 1, #ConfigTable do ConfigTable[i]:Size(db.size * 2.5, db.size) end - -- UB.menuHolder.Addon:Size(db.size) for i = 1, #AddonTable do AddonTable[i]:Size(db.size * 3, db.size) end @@ -536,50 +623,80 @@ function UB:FrameSize() for i = 1, #StatusTable do StatusTable[i]:Size(db.size * 2, db.size) end + UB.menuHolder.Roll:Size(db.size * 2, (db.size * #RollTable)+(db.spacing*(#RollTable-1))) + for i = 1, #RollTable do + RollTable[i]:Size(db.size * 2, db.size) + end - UB:Positioning() + UB:Positioning(onLoad) end -function UB:UpdateConfigLayout() +function UB:UpdateConfigLayout(load) local db = E.db.sle.uibuttons - for i = 1, #ConfigTable do - ConfigTable[i]:ClearAllPoints() + local button = UB.menuHolder.Config.Toggle + UB.menuHolder.Config:ClearAllPoints() + UB.menuHolder.Config:Point(db.point, button, db.anchor, db.xoffset, db.yoffset) + if load then + UB.menuHolder.Config.Elv:Point("TOP", UB.menuHolder.Config, "TOP", 0, 0) + UB.menuHolder.Config.SLE:Point("TOP", UB.menuHolder.Config.Elv, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + if IsAddOnLoaded("BenikUI") then + UB.menuHolder.Config.Benik:Point("TOP", UB.menuHolder.Config.SLE, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB.menuHolder.Config.Reload:Point("TOP", UB.menuHolder.Config.Benik, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + else + UB.menuHolder.Config.Reload:Point("TOP", UB.menuHolder.Config.SLE, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + end + UB.menuHolder.Config.MoveUI:Point("TOP", UB.menuHolder.Config.Reload, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) end - UB.menuHolder.Config.Elv:Point("TOP", UB.menuHolder.Config, "TOP", 0, 0) - UB.menuHolder.Config.SLE:Point("TOP", UB.menuHolder.Config.Elv, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - UB.menuHolder.Config.Reload:Point("TOP", UB.menuHolder.Config.SLE, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - UB.menuHolder.Config.MoveUI:Point("TOP", UB.menuHolder.Config.Reload, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) end -function UB:UpdateAddonLayout() +function UB:UpdateAddonLayout(load) local count = 0 + local button = UB.menuHolder.Addon.Toggle local db = E.db.sle.uibuttons - UB.menuHolder.Addon.Manager:ClearAllPoints() - UB.menuHolder.Addon.Manager:Point("TOP", UB.menuHolder.Addon, "TOP", 0, 0) - for i = 2, #AddonTable do - AddonTable[i]:ClearAllPoints() - if AddonTable[i].shown then - AddonTable[i]:Point("TOP", UB.menuHolder.Addon.Manager, "BOTTOM", 0, -(count * (db.size)) - (count + 1) * (E.PixelMode and db.spacing or (db.spacing+2))+(E.PixelMode and 0 or 1)) - AddonTable[i]:Show() - count = count + 1 - else - AddonTable[i]:Hide() + UB.menuHolder.Addon:ClearAllPoints() + UB.menuHolder.Addon:Point(db.point, button, db.anchor, db.xoffset, db.yoffset) + if load then + UB.menuHolder.Addon.Manager:Point("TOP", UB.menuHolder.Addon, "TOP", 0, 0) + for i = 2, #AddonTable do + if AddonTable[i].shown then + AddonTable[i]:Point("TOP", UB.menuHolder.Addon.Manager, "BOTTOM", 0, -(count * (db.size)) - (count + 1) * (E.PixelMode and db.spacing or (db.spacing+2))+(E.PixelMode and 0 or 1)) + AddonTable[i]:Show() + count = count + 1 + else + AddonTable[i]:Hide() + end end - -- if db.position == "uib_vert" then - -- if db.buttonGrow == "up" then - - -- else - -- end - -- else - -- if db.buttonGrow == "up" then - -- else - -- end - -- end - end - UB.menuHolder.Addon:Size(db.size * 3, (db.size * (count+1))+(db.spacing*(count))) + UB.menuHolder.Addon:Size(db.size * 3, (db.size * (count+1))+(db.spacing*(count))) + end +end + +function UB:UpdateStatusLayout(load) + local button = UB.menuHolder.Status.Toggle + local db = E.db.sle.uibuttons + UB.menuHolder.Status:ClearAllPoints() + UB.menuHolder.Status:Point(db.point, button, db.anchor, db.xoffset, db.yoffset) + if load then + UB.menuHolder.Status.AFK:Point("TOP", UB.menuHolder.Status, "TOP", 0, 0) + UB.menuHolder.Status.DND:Point("TOP", UB.menuHolder.Status.AFK, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + end +end + +function UB:UpdateRollLayout(load) + local button = UB.menuHolder.Roll.Toggle + local db = E.db.sle.uibuttons + UB.menuHolder.Roll:ClearAllPoints() + UB.menuHolder.Roll:Point(db.point, button, db.anchor, db.xoffset, db.yoffset) + if load then + UB.menuHolder.Roll.Ten:Point("TOP", UB.menuHolder.Roll, "TOP", 0, 0) + UB.menuHolder.Roll.Twenty:Point("TOP", UB.menuHolder.Roll.Ten, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB.menuHolder.Roll.Thirty:Point("TOP", UB.menuHolder.Roll.Twenty, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB.menuHolder.Roll.Forty:Point("TOP", UB.menuHolder.Roll.Thirty, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB.menuHolder.Roll.Hundred:Point("TOP", UB.menuHolder.Roll.Forty, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB.menuHolder.Roll.Custom:Point("TOP", UB.menuHolder.Roll.Hundred, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + end end -function UB:Positioning() +function UB:Positioning(load) local db = E.db.sle.uibuttons for i = 1, #ToggleTable do ToggleTable[i]:ClearAllPoints() @@ -587,37 +704,20 @@ function UB:Positioning() --position check if db.position == "uib_vert" then UB.menuHolder.Config.Toggle:Point("TOP", UB.menuHolder, "TOP", 0, (E.PixelMode and -1 or -2)) - UB.menuHolder.Addon.Toggle:Point("TOP", UB.menuHolder.Config.Toggle, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - UB.menuHolder.Status.Toggle:Point("TOP", UB.menuHolder.Addon.Toggle, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- Mbutton:Point("TOP", Rbutton, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- Bbutton:Point("TOP", Mbutton, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- Abutton:Point("TOP", Bbutton, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- if Fbutton then - -- Fbutton:Point("TOP", Abutton, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- end + for i = 2, #ToggleTable do + ToggleTable[i]:Point("TOP", ToggleTable[i-1], "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + end else UB.menuHolder.Config.Toggle:Point("LEFT", UB.menuHolder, "LEFT", (E.PixelMode and 1 or 2), 0) - UB.menuHolder.Addon.Toggle:Point("LEFT", UB.menuHolder.Config.Toggle, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - UB.menuHolder.Status.Toggle:Point("LEFT", UB.menuHolder.Addon.Toggle, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - -- Mbutton:Point("LEFT", Rbutton, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - -- Bbutton:Point("LEFT", Mbutton, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - -- Abutton:Point("LEFT", Bbutton, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - -- if Fbutton then - -- Fbutton:Point("LEFT", Abutton, "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) - -- end + for i = 2, #ToggleTable do + ToggleTable[i]:Point("LEFT", ToggleTable[i-1], "RIGHT", (E.PixelMode and db.spacing or db.spacing+2), 0) + end end - -- SLEUIConfigElv:Point("TOPRIGHT", UB.menuHolder.Config, "TOPRIGHT", 2, 2) - -- SLEUIConfigElv:Point("TOP", UB.menuHolder.Config, "TOP", 0, 0) - -- SLEUIConfigSLE:Point("TOP", UB.menuHolder.Config.Elv, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- SLEUIConfigReload:Point("TOP", UB.menuHolder.Config.SLE, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - -- SLEUIConfigMoveUI:Point("TOP", UB.menuHolder.Config.Reload, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) - UB:UpdateConfigLayout() - UB:UpdateAddonLayout() - -- SLEUIStatusHolder:Point("TOP", UB.menuHolder.Status, "TOP", 0, 0) - - -- SLEUIAddonManager:Point("TOPRIGHT", UB.menuHolder.Addon, "TOPRIGHT", (E.PixelMode and 3 or 4), 2) - -- SLEUIAddonBoss:Point("TOP", UB.menuHolder.Addon.Manager, "BOTTOM", 0, (E.PixelMode and -db.spacing or -(db.spacing+2))) + UB:UpdateConfigLayout(load) + UB:UpdateAddonLayout(load) + UB:UpdateStatusLayout(load) + UB:UpdateRollLayout(load) end function UB:Toggle() @@ -625,13 +725,12 @@ function UB:Toggle() UB.menuHolder:Hide() else UB.menuHolder:Show() - -- UB:UpdateMouseOverSetting() end end function UB:Initialize() UB:CreateFrame() - UB:FrameSize() + UB:FrameSize(true) UB:Toggle() E.FrameLocks['UB.menuHolder'] = true diff --git a/ElvUI_SLE/options/uibuttons_c.lua b/ElvUI_SLE/options/uibuttons_c.lua index 2b7a9ab..1497629 100644 --- a/ElvUI_SLE/options/uibuttons_c.lua +++ b/ElvUI_SLE/options/uibuttons_c.lua @@ -1,6 +1,18 @@ local E, L, V, P, G = unpack(ElvUI); local UB = E:GetModule('SLE_UIButtons') +local positionValues = { + TOPLEFT = 'TOPLEFT', + LEFT = 'LEFT', + BOTTOMLEFT = 'BOTTOMLEFT', + RIGHT = 'RIGHT', + TOPRIGHT = 'TOPRIGHT', + BOTTOMRIGHT = 'BOTTOMRIGHT', + CENTER = 'CENTER', + TOP = 'TOP', + BOTTOM = 'BOTTOM', +}; + local function configTable() E.Options.args.sle.args.options.args.general.args.uibuttons = { type = "group", @@ -77,6 +89,64 @@ local function configTable() get = function(info) return E.db.sle.uibuttons.position end, set = function(info, value) E.db.sle.uibuttons.position = value; UB:FrameSize() end, }, + point = { + type = 'select', + order = 13, + name = L['Anchor Point'], + desc = L['What point of dropdown will be attached to the toggle button.'], + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.point end, + set = function(info, value) E.db.sle.uibuttons.point = value; UB:FrameSize() end, + values = positionValues, + }, + anchor = { + type = 'select', + order = 14, + name = L['Attach To'], + desc = L['What point to anchor dropdown on the toggle button.'], + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.anchor end, + set = function(info, value) E.db.sle.uibuttons.anchor = value; UB:FrameSize() end, + values = positionValues, + }, + xoffset = { + order = 15, + type = "range", + name = L['X-Offset'], + desc = L["Horizontal offset of dropdown from the toggle button."], + min = -10, max = 10, step = 1, + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.xoffset end, + set = function(info, value) E.db.sle.uibuttons.xoffset = value; UB:FrameSize() end, + }, + yoffset = { + order = 16, + type = "range", + name = L['Y-Offset'], + desc = L["Vertical offset of dropdown from the toggle button."], + min = -10, max = 10, step = 1, + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.yoffset end, + set = function(info, value) E.db.sle.uibuttons.yoffset = value; UB:FrameSize() end, + }, + minroll = { + order = 17, + type = 'input', + name = L["Minimum Roll Value"], + desc = L["The lower limit for custom roll button."], + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.roll.min end, + set = function(info, value) E.db.sle.uibuttons.roll.min = value; end, + }, + maxroll = { + order = 18, + type = 'input', + name = L["Maximum Roll Value"], + desc = L["The higher limit for custom roll button."], + disabled = function() return not E.db.sle.uibuttons.enable end, + get = function(info) return E.db.sle.uibuttons.roll.max end, + set = function(info, value) E.db.sle.uibuttons.roll.max = value; end, + }, }, } end -- 1.7.9.5