Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunny67 committed Oct 9, 2016
0 parents commit 0d7c70b
Show file tree
Hide file tree
Showing 26 changed files with 2,319 additions and 0 deletions.
108 changes: 108 additions & 0 deletions ElvUI_CustomTweaks/Categories/actionbars/ClickThroughActionBars.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
local E, L, V, P, G = unpack(ElvUI)
local AB = E:GetModule("ActionBars")
local CT = E:GetModule("CustomTweaks")
local isEnabled = E.private["actionbar"].enable and E.private["CustomTweaks"] and E.private["CustomTweaks"]["ClickThroughActionBars"] and true or false

--Cache global variables
local _G = _G
local NUM_ACTIONBAR_BUTTONS = NUM_ACTIONBAR_BUTTONS
local NUM_PET_ACTION_SLOTS = NUM_PET_ACTION_SLOTS
local NUM_SHAPESHIFT_SLOTS = NUM_SHAPESHIFT_SLOTS

---
-- GLOBALS: IsAddOnLoaded, ElvUI_StanceBar, ElvUI_BarPet
---

P["CustomTweaks"]["ClickThroughActionBars"] = {
["bar1"] = false,
["bar2"] = false,
["bar3"] = false,
["bar4"] = false,
["bar5"] = false,
["bar6"] = false,
["bar7"] = false,
["bar8"] = false,
["bar9"] = false,
["bar10"] = false,
["barPet"] = false,
["stanceBar"] = false,
}

local function ConfigTable()
E.Options.args.CustomTweaks.args.Actionbar.args.options.args.ClickThroughActionBars = {
type = "group",
name = "ClickThroughActionBars",
args = {
barPet = {
order = 11,
type = "toggle",
name = L["Pet Bar"],
disabled = function() return not isEnabled end,
get = function(info) return E.db.CustomTweaks["ClickThroughActionBars"]["barPet"] end,
set = function(info, value) E.db.CustomTweaks["ClickThroughActionBars"]["barPet"] = value; AB:PositionAndSizeBarPet() end,
},
stanceBar = {
order = 12,
type = "toggle",
name = L["Stance Bar"],
disabled = function() return not isEnabled end,
get = function(info) return E.db.CustomTweaks["ClickThroughActionBars"]["stanceBar"] end,
set = function(info, value) E.db.CustomTweaks["ClickThroughActionBars"]["stanceBar"] = value; AB:PositionAndSizeBarShapeShift() end,
},
},
}

local numBars = 6
if IsAddOnLoaded("ElvUI_ExtraActionBars") then
numBars = 10
end

for i = 1, numBars do
E.Options.args.CustomTweaks.args.Actionbar.args.options.args.ClickThroughActionBars.args["bar"..i] = {
order = i,
type = "toggle",
name = L["Bar "]..i,
disabled = function() return not isEnabled end,
get = function(info) return E.db.CustomTweaks["ClickThroughActionBars"]["bar"..i] end,
set = function(info, value) E.db.CustomTweaks["ClickThroughActionBars"]["bar"..i] = value; AB:PositionAndSizeBar("bar"..i) end,
}
end
end
CT.Configs["ClickThroughActionBars"] = ConfigTable
if not isEnabled then return; end

local function PositionAndSizeBar(self, barName)
local clickThrough = E.db.CustomTweaks.ClickThroughActionBars[barName]
local bar = AB["handledBars"][barName]
local button

bar:EnableMouse(not clickThrough)
for i=1, NUM_ACTIONBAR_BUTTONS do
button = bar.buttons[i];
button:EnableMouse(not clickThrough)
end
end

local function PositionAndSizeBarShapeShift(self)
ElvUI_StanceBar:EnableMouse(not E.db.CustomTweaks.ClickThroughActionBars.stanceBar)

local button
for i=1, NUM_SHAPESHIFT_SLOTS do
button = _G["ElvUI_StanceBarButton"..i];
button:EnableMouse(not E.db.CustomTweaks.ClickThroughActionBars.stanceBar)
end
end

local function PositionAndSizeBarPet(self)
ElvUI_BarPet:EnableMouse(not E.db.CustomTweaks.ClickThroughActionBars.barPet)

local button
for i=1, NUM_PET_ACTION_SLOTS do
button = _G["PetActionButton"..i];
button:EnableMouse(not E.db.CustomTweaks.ClickThroughActionBars.barPet)
end
end

hooksecurefunc(AB, "PositionAndSizeBar", PositionAndSizeBar)
hooksecurefunc(AB, "PositionAndSizeBarShapeShift", PositionAndSizeBarShapeShift)
hooksecurefunc(AB, "PositionAndSizeBarPet", PositionAndSizeBarPet)
61 changes: 61 additions & 0 deletions ElvUI_CustomTweaks/Categories/actionbars/PushedColor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
local E, L, V, P, G = unpack(ElvUI)
local AB = E:GetModule("ActionBars")
local CT = E:GetModule("CustomTweaks")
local isEnabled = E.private["actionbar"].enable and E.private["CustomTweaks"] and E.private["CustomTweaks"]["PushedColor"] and true or false

--Cache global variables
local pairs = pairs

P["CustomTweaks"]["PushedColor"] = {
["Color"] = {r = 1, g = 0, b = 0, a = 0.3},
}

local function UpdateBars()
for barName in pairs(AB["handledBars"]) do
AB:PositionAndSizeBar(barName)
end
AB:PositionAndSizeBarPet()
AB:PositionAndSizeBarShapeShift()
end

local function ConfigTable()
E.Options.args.CustomTweaks.args.Actionbar.args.options.args.PushedColor = {
type = "group",
name = "PushedColor",
args = {
color = {
order = 1,
type = "color",
name = L["Color"],
disabled = function() return not isEnabled end,
hasAlpha = true,
get = function(info)
local t = E.db.CustomTweaks.PushedColor.Color
local d = P.CustomTweaks.PushedColor.Color
return t.r, t.g, t.b, t.a, d.r, d.g, d.b, d.a
end,
set = function(info, r, g, b, a)
E.db.CustomTweaks.PushedColor.Color = {}
local t = E.db.CustomTweaks.PushedColor.Color
t.r, t.g, t.b, t.a = r, g, b, a
UpdateBars()
end,
},
},
}
end
CT.Configs["PushedColor"] = ConfigTable
if not isEnabled then return; end

local function StyleButton(self, button, noBackdrop, adjustChecked)
if button.SetPushedTexture then
local c = E.db.CustomTweaks.PushedColor.Color
local r, g, b, a = c.r, c.g, c.b, c.a
local pushedmod = button:CreateTexture("frame", nil, self)
pushedmod:SetTexture(r, g, b, a)
pushedmod:SetInside()
button.pushedmod = pushedmod
button:SetPushedTexture(pushedmod)
end
end
hooksecurefunc(AB, "StyleButton", StyleButton)
4 changes: 4 additions & 0 deletions ElvUI_CustomTweaks/Categories/actionbars/load_tweaks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='ClickThroughActionBars.lua'/>
<Script file='PushedColor.lua'/>
</Ui>
Loading

0 comments on commit 0d7c70b

Please sign in to comment.