Commit 77384236 authored by Blazeflack's avatar Blazeflack

Made it possible to change settings without having to reload

parent d62d6f1a
......@@ -67,7 +67,7 @@ function VAT:InsertOptions()
type = 'group',
name = L['Statusbar Options'],
get = function(info) return E.db.VAT[ info[#info] ] end,
set = function(info, value) E.db.VAT[ info[#info] ] = value; end,
set = function(info, value) E.db.VAT[ info[#info] ] = value; A:UpdateHeader(ElvUIPlayerBuffs); A:UpdateHeader(ElvUIPlayerDebuffs) end,
args = {
info1 = {
order = 1,
......@@ -106,7 +106,6 @@ function VAT:InsertOptions()
order = 1,
name = L['Statusbar Position'],
desc = L['Choose where you want the statusbar to be positioned. If you position it on the left or right side of the icon I advice you to increase Horizontal Spacing for Buffs and Debuffs. Changing this requires you to reload UI.'],
set = function(info, value) E.db.VAT.position = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return not E.db.VAT.enable end,
values = {
['TOP'] = L['Above Icons'],
......@@ -121,7 +120,6 @@ function VAT:InsertOptions()
name = L['Statusbar Spacing'],
desc = L['Additional spacing between icon and statusbar. If a negative value is chosen then the statusbar is shown inside the icon. Changing this requires you to reload UI.'],
min = -20, max = 20, step = 1,
set = function(info, value) E.db.VAT.spacing = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return not E.db.VAT.enable end,
},
spacer1 = {
......@@ -134,8 +132,7 @@ function VAT:InsertOptions()
order = 4,
name = L['Statusbar Height'],
desc = L['Height of the statusbar frame (default: 5). Changing this requires you to reload UI.'],
min = 5, max = 10, step = 1,
set = function(info, value) E.db.VAT.barHeight = value; E:StaticPopup_Show("CONFIG_RL") end,
min = 3, max = 20, step = 1,
disabled = function() return not E.db.VAT.enable or (E.db.VAT.position == 'LEFT') or (E.db.VAT.position == 'RIGHT') end,
},
barWidth = {
......@@ -143,8 +140,7 @@ function VAT:InsertOptions()
order = 5,
name = L['Statusbar Width'],
desc = L['Width of the statusbar frame (default: 6). Changing this requires you to reload UI.'],
min = 5, max = 10, step = 1,
set = function(info, value) E.db.VAT.barWidth = value; E:StaticPopup_Show("CONFIG_RL") end,
min = 3, max = 20, step = 1,
disabled = function() return not E.db.VAT.enable or (E.db.VAT.position == 'BOTTOM') or (E.db.VAT.position == 'TOP') end,
},
},
......@@ -160,7 +156,6 @@ function VAT:InsertOptions()
order = 1,
name = L['Use Statusbar Texture'],
desc = L['Allows you to choose which texture to use for statusbars. If disabled, no texture will be used.'],
set = function(info, value) E.db.VAT.useStatusbarTexture = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return not E.db.VAT.enable end,
},
statusbarTexture = {
......@@ -168,7 +163,6 @@ function VAT:InsertOptions()
dialogControl = 'LSM30_Statusbar',
order = 2,
name = L['Statusbar Texture'],
set = function(info, value) E.db.VAT.statusbarTexture = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return (not E.db.VAT.useStatusbarTexture or not E.db.VAT.enable) end,
values = AceGUIWidgetLSMlists.statusbar,
},
......@@ -182,7 +176,6 @@ function VAT:InsertOptions()
order = 4,
name = L['Use Backdrop Texture'],
desc = L['Allows you to choose which texture to use for statusbar backdrops. If disabled, no texture will be used.'],
set = function(info, value) E.db.VAT.useBackdropTexture = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return not E.db.VAT.enable end,
},
backdropTexture = {
......@@ -190,7 +183,7 @@ function VAT:InsertOptions()
dialogControl = 'LSM30_Statusbar',
order = 5,
name = L['Statusbar Backdrop Texture'],
set = function(info, value) E.db.VAT.backdropTexture = value; E:StaticPopup_Show("CONFIG_RL") end,
disabled = function() return (not E.db.VAT.useBackdropTexture or not E.db.VAT.enable) end,
values = AceGUIWidgetLSMlists.statusbar,
},
......
......@@ -318,6 +318,47 @@ function VAT:UpdateTempEnchant(button, index)
end
end
function VAT:UpdateHeader(header)
if (not E.private.auras.enable) then return end
local db = A.db.debuffs
if header:GetAttribute('filter') == 'HELPFUL' then
db = A.db.buffs
end
local width = db.size;
local height = db.size;
local pos = E.db.VAT.position;
local spacing = E.db.VAT.spacing
local isOnTop = pos == 'TOP' and true or false;
local isOnBottom = pos == 'BOTTOM' and true or false;
local isOnLeft = pos == 'LEFT' and true or false;
local isOnRight = pos == 'RIGHT' and true or false;
local index = 1
local child = select(index, header:GetChildren())
while (child) do
if (child.Holder) then
child.Holder:Width((isOnTop or isOnBottom) and width or (E.db.VAT.barWidth + (E.PixelMode and 0 or 2)))
child.Holder:Height((isOnLeft or isOnRight) and height or (E.db.VAT.barHeight + (E.PixelMode and 0 or 2)))
child.Holder:ClearAllPoints()
child.Holder:Point(inversePoints[pos], child, pos, (isOnTop or isOnBottom) and 0 or ((isOnLeft and -((E.PixelMode and 1 or 3) + spacing)) or ((E.PixelMode and 1 or 3) + spacing)), (isOnLeft or isOnRight) and 0 or ((isOnTop and ((E.PixelMode and 1 or 3) + spacing) or -((E.PixelMode and 1 or 3) + spacing))))
child.Holder:SetTemplate('Default', nil, true)
child.Holder.backdropTexture:SetTexture(E.db.VAT.useBackdropTexture and LSM:Fetch("statusbar", E.db['VAT'].backdropTexture) or E['media'].blankTex)
child.Bar:SetStatusBarTexture(E.db.VAT.useStatusbarTexture and LSM:Fetch("statusbar", E.db['VAT'].statusbarTexture) or E['media'].blankTex)
if isOnLeft or isOnRight then
child.Bar:SetOrientation('VERTICAL')
else
child.Bar:SetOrientation('HORIZONTAL')
end
end
index = index + 1
child = select(index, header:GetChildren())
end
end
function VAT:UpdateTime(elapsed)
if(self.offset) then
local expiration = select(self.offset, GetWeaponEnchantInfo())
......@@ -405,4 +446,5 @@ function VAT:Initialize()
hooksecurefunc(A, 'CreateIcon', VAT.CreateBar)
hooksecurefunc(A, 'UpdateAura', VAT.UpdateAura)
hooksecurefunc(A, 'UpdateTempEnchant', VAT.UpdateTempEnchant)
hooksecurefunc(A, "UpdateHeader", VAT.UpdateHeader)
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment