Quantcast

Merge pull request #17 from Darthpred/33f97dddfedece34ef06a60151003d0ca2e347a1

Alex [11-11-12 - 13:34]
Merge pull request #17 from Darthpred/33f97dddfedece34ef06a60151003d0ca2e347a1

Backgrounds convertion
Filename
ElvUI_SLE/ElvUI_SLE.lua
ElvUI_SLE/modules/backgrounds/backgrounds.lua
ElvUI_SLE/modules/backgrounds/options.lua
diff --git a/ElvUI_SLE/ElvUI_SLE.lua b/ElvUI_SLE/ElvUI_SLE.lua
index 581b4e3..d835413 100644
--- a/ElvUI_SLE/ElvUI_SLE.lua
+++ b/ElvUI_SLE/ElvUI_SLE.lua
@@ -52,6 +52,7 @@ E.UpdateAllSLE = E.UpdateAll
 function E:UpdateAll()
     E.UpdateAllSLE(self)
 	E:GetModule('BackGrounds'):UpdateFrames()
+	E:GetModule('BackGrounds'):RegisterHide()
 	DTP:Update()
 	DTP:DashboardShow()
 	DTP:DashWidth()
diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua
index 22c6678..b0ff229 100644
--- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua
+++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua
@@ -1,128 +1,77 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
 local BG = E:NewModule('BackGrounds', 'AceHook-3.0', 'AceEvent-3.0');

-local BGbottom = CreateFrame('Frame', "BottomBG", E.UIParent);
-local BGleft = CreateFrame('Frame', "LeftBG", E.UIParent);
-local BGright = CreateFrame('Frame', "RightBG", E.UIParent);
-local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent);
+local BGb = CreateFrame('Frame', "BottomBG", E.UIParent);
+local BGl = CreateFrame('Frame', "LeftBG", E.UIParent);
+local BGr = CreateFrame('Frame', "RightBG", E.UIParent);
+local BGa = CreateFrame('Frame', "ActionBG", E.UIParent);
+
+local Fr = {
+	BottomBG = {BGb,"bottom"},
+	LeftBG = {BGl,"left"},
+	RightBG = {BGr,"right"},
+	ActionBG = {BGa,"action"},
+}

 --Frames setup
 function BG:FramesCreate()
-	--Bottom
-	BGbottom:CreateBackdrop(E.private.sle.backgrounds.bottom.template);
-	BGbottom.backdrop:SetAllPoints();
-	BGbottom:SetFrameLevel(BGbottom:GetFrameLevel() - 1)
-	BGbottom:SetFrameStrata('BACKGROUND');
-	BGbottom:EnableMouse(true)
-	BGbottom:SetScript("OnShow", function() BGbottom:SetFrameStrata('BACKGROUND') end)
-	--Texture
-	BGbottom.tex = BGbottom:CreateTexture(nil, 'OVERLAY')
-	BGbottom.tex:SetAlpha(0.5)
-
-	--Left
-	BGleft:CreateBackdrop(E.private.sle.backgrounds.left.template);
-	BGleft.backdrop:SetAllPoints();
-	BGleft:SetFrameLevel(BGleft:GetFrameLevel() - 1)
-	BGleft:SetFrameStrata('BACKGROUND');
-	BGleft:SetScript("OnShow", function() BGleft:SetFrameStrata('BACKGROUND') end)
-	--Texture
-	BGleft.tex = BGleft:CreateTexture(nil, 'OVERLAY')
-	BGleft.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)
+	local pr = E.private.sle.backgrounds
+	for _,v in pairs(Fr) do
+		v[1]:CreateBackdrop(pr[v[2]].template);
+		v[1].backdrop:SetAllPoints();
+		v[1]:SetFrameLevel(v[1]:GetFrameLevel() - 1)
+		v[1]:SetScript("OnShow", function() v[1]:SetFrameStrata('BACKGROUND') end)
+		v[1].tex = v[1]:CreateTexture(nil, 'OVERLAY')
+		v[1]:Hide()
+	end
+
+	BGb:EnableMouse(true) --Maybe add an option to actually allow change this click catching?
+	BGb.tex:SetAlpha(0.5)
+	--Also the problem. As long as bottom bg can be transparent it's no good in keeping fixed transparency for the texture.
+	--Maybe add an option to change this from using Elv's trnsparency to additional user-set one?
+	BGl.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)

-	--Right
-	BGright:CreateBackdrop(E.private.sle.backgrounds.right.template);
-	BGright.backdrop:SetAllPoints();
-	BGright:SetFrameLevel(BGright:GetFrameLevel() - 1)
-	BGright:SetFrameStrata('BACKGROUND');
-	BGright:SetScript("OnShow", function() BGright:SetFrameStrata('BACKGROUND') end)
-	--Texture
-	BGright.tex = BGright:CreateTexture(nil, 'OVERLAY')
-	BGright.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)
+	BGr.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)

-	--Action
-	BGaction:CreateBackdrop(E.private.sle.backgrounds.action.template);
-	BGaction.backdrop:SetAllPoints();
-	BGaction:SetFrameLevel(BGaction:GetFrameLevel() - 1)
-	BGaction:SetFrameStrata('BACKGROUND');
-	BGaction:EnableMouse(true)
-	BGaction:SetScript("OnShow", function() BGaction:SetFrameStrata('BACKGROUND') end)
-	--Texture
-	BGaction.tex = BGaction:CreateTexture(nil, 'OVERLAY')
-	BGaction.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)
-
-	--Hiding
-	BGbottom:Hide()
-	BGleft:Hide()
-	BGright:Hide()
-	BGaction:Hide()
+	BGa:EnableMouse(true)
+	BGa.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5)
 end

 --Frames Size
 function BG:FramesSize()
-	BGbottom:SetWidth(E.db.sle.backgrounds.bottom.width)
-	BGbottom:SetHeight(E.db.sle.backgrounds.bottom.height)
-
-	BGleft:SetWidth(E.db.sle.backgrounds.left.width)
-	BGleft:SetHeight(E.db.sle.backgrounds.left.height)
-
-	BGright:SetWidth(E.db.sle.backgrounds.right.width)
-	BGright:SetHeight(E.db.sle.backgrounds.right.height)
-
-	BGaction:SetWidth(E.db.sle.backgrounds.action.width)
-	BGaction:SetHeight(E.db.sle.backgrounds.action.height)
+	local db = E.db.sle.backgrounds
+	for _,v in pairs(Fr) do
+		v[1]:SetSize(db[v[2]].width, db[v[2]].height)
+	end
 end

 --Frames points
 function BG:FramesPositions()
-	BGbottom:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset);
-	BGleft:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset);
-	BGright:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset);
-	BGaction:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset);
+	BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset);
+	BGl:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset);
+	BGr:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset);
+	BGa:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset);
 end

 --Updating textures
 function BG:UpdateTex()
-	BGbottom.tex:Point('TOPLEFT', BGbottom, 'TOPLEFT', 2, -2)
-	BGbottom.tex:Point('BOTTOMRIGHT', BGbottom, 'BOTTOMRIGHT', -2, 2)
-	BGbottom.tex:SetTexture(E.db.sle.backgrounds.bottom.texture)
-
-	BGright.tex:Point('TOPLEFT', BGright, 'TOPLEFT', 2, -2)
-	BGright.tex:Point('BOTTOMRIGHT', BGright, 'BOTTOMRIGHT', -2, 2)
-	BGright.tex:SetTexture(E.db.sle.backgrounds.right.texture)
-
-	BGleft.tex:Point('TOPLEFT', BGleft, 'TOPLEFT', 2, -2)
-	BGleft.tex:Point('BOTTOMRIGHT', BGleft, 'BOTTOMRIGHT', -2, 2)
-	BGleft.tex:SetTexture(E.db.sle.backgrounds.left.texture)
-
-	BGaction.tex:Point('TOPLEFT', BGaction, 'TOPLEFT', 2, -2)
-	BGaction.tex:Point('BOTTOMRIGHT', BGaction, 'BOTTOMRIGHT', -2, 2)
-	BGaction.tex:SetTexture(E.db.sle.backgrounds.action.texture)
+	local db = E.db.sle.backgrounds
+	for _,v in pairs(Fr) do
+		v[1].tex:Point('TOPLEFT', v[1], 'TOPLEFT', 2, -2)
+		v[1].tex:Point('BOTTOMRIGHT', v[1], 'BOTTOMRIGHT', -2, 2)
+		v[1].tex:SetTexture(db[v[2]].texture)
+	end
 end

 --Visibility / Enable check
 function BG:FramesVisibility()
-	if E.db.sle.backgrounds.bottom.enabled then
-		BGbottom:Show()
-	else
-		BGbottom:Hide()
-	end
-
-	if E.db.sle.backgrounds.left.enabled then
-		BGleft:Show()
-	else
-		BGleft:Hide()
-	end
-
-	if E.db.sle.backgrounds.right.enabled then
-		BGright:Show()
-	else
-		BGright:Hide()
-	end
-
-	if E.db.sle.backgrounds.action.enabled then
-		BGaction:Show()
-	else
-		BGaction:Hide()
+	local db = E.db.sle.backgrounds
+	for _,v in pairs(Fr) do
+		if db[v[2]].enabled then
+			v[1]:Show()
+		else
+			v[1]:Hide()
+		end
 	end
 end

@@ -133,43 +82,20 @@ function BG:UpdateFrames()
     BG:UpdateTex()
 end

---Hook to updating during profile change
-E.UpdateAllHUD = E.UpdateAll
-function E:UpdateAll()
-    E.UpdateAllHUD(self)
-
-	BG:UpdateFrames()
-end
-
 function BG:RegisterHide()
-	if E.db.sle.backgrounds.bottom.pethide then
-		E.FrameLocks['BottomBG'] = true
-	else
-		E.FrameLocks['BottomBG'] = nil
-	end
-	if E.db.sle.backgrounds.left.pethide then
-		E.FrameLocks['LeftBG'] = true
-	else
-		E.FrameLocks['LeftBG'] = nil
-	end
-	if E.db.sle.backgrounds.right.pethide then
-		E.FrameLocks['RightBG'] = true
-	else
-		E.FrameLocks['RightBG'] = nil
-	end
-	if E.db.sle.backgrounds.action.pethide then
-		E.FrameLocks['ActionBG'] = true
-	else
-		E.FrameLocks['ActionBG'] = nil
+	local db = E.db.sle.backgrounds
+	for k,v in pairs(Fr) do
+		if db[v[2]].pethide then
+			E.FrameLocks[k] = true
+		else
+			E.FrameLocks[k] = nil
+		end
 	end
 end

 function BG:Initialize()
-	BG:FramesPositions()
-	BG:FramesSize()
 	BG:FramesCreate()
-	BG:FramesVisibility()
-	BG:UpdateTex()
+	BG:UpdateFrames()
 	BG:RegisterHide()
 end

diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua
index cc21f01..b818700 100644
--- a/ElvUI_SLE/modules/backgrounds/options.lua
+++ b/ElvUI_SLE/modules/backgrounds/options.lua
@@ -1,6 +1,14 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
 local BG = E:GetModule('BackGrounds')

+local drop = {
+	--Group name = {short name, order, minimum width}
+	["Bottom BG"] = {"bottom", 1, 200},
+	["Left BG"] = {"left", 2, 150},
+	["Right BG"] = {"right", 3, 150},
+	["Actionbar BG"] = {"action", 4, 200},
+}
+
 --Options for additional background frames. Main group
 E.Options.args.sle.args.backgrounds = {
 	type = "group",
@@ -57,338 +65,85 @@ E.Options.args.sle.args.backgrounds = {
 		},
 	}
 }
---Subgroup for 1st frame. They are based on the same pattern
-E.Options.args.sle.args.backgrounds.args.bottom = {
-	type = "group",
-	name = L["Bottom BG"],
-	order = 1,
-	disabled = function() return not E.db.sle.backgrounds.bottom.enabled end,
-	args = {
-		width = { --setting width (obviously)
-			order = 3,
-			type = "range",
-			name = L['Width'],
-			desc = L["Sets width of the frame"],
-			min = 200, max = E.screenwidth, step = 1,
-			get = function(info) return E.db.sle.backgrounds.bottom.width end,
-			set = function(info, value) E.db.sle.backgrounds.bottom.width = value; BG:FramesSize() end,
-		},
-		height = {
-			order = 4,
-			type = "range",
-			name = L['Height'],
-			desc = L["Sets height of the frame"],
-			min = 50, max = E.screenheight/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.bottom.height end,
-			set = function(info, value) E.db.sle.backgrounds.bottom.height = value; BG:FramesSize() end,
-		},
-		spacer = { --Empty slot for making sliders move to next line
-			order = 5,
-			type = "description",
-			name = "",
-		},
-		--Main means of moving frames. To create actual mover for them is veeeeeeeeeeery crapy idea.
-		xoffset = {
-			order = 6,
-			type = "range",
-			name = L['X Offset'],
-			desc = L["Sets X offset of the frame"],
-			min = -E.screenwidth/2, max = E.screenwidth/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.bottom.xoffset end,
-			set = function(info, value) E.db.sle.backgrounds.bottom.xoffset = value; BG:FramesPositions() end,
-		},
-		yoffset = {
-			order = 7,
-			type = "range",
-			name = L['Y Offset'],
-			desc = L["Sets Y offset of the frame"],
-			min = -21, max = E.screenheight, step = 1,
-			get = function(info) return E.db.sle.backgrounds.bottom.yoffset end,
-			set = function(info, value) E.db.sle.backgrounds.bottom.yoffset = value; BG:FramesPositions() end,
-		},
-		--Setting custom texture for those who like it
-		texture = {
-			order = 8,
-			type = 'input',
-			width = 'full',
-			name = L["Texture"],
-			desc = L["Set the texture to use in this frame.  Requirements are the same as the chat textures."],
-			get = function(info) return E.db.sle.backgrounds.bottom.texture end,
-			set = function(info, value)
-				E.db.sle.backgrounds.bottom.texture = value
-				E:UpdateMedia()
-				BG:UpdateTex()
-			end,
-		},
-		template = {
-			order = 9,
-			type = "select",
-			name = L["Backdrop Template"],
-			desc = L["Change the template used for this backdrop."],
-			get = function(info) return E.private.sle.backgrounds.bottom.template end,
-			set = function(info, value) E.private.sle.backgrounds.bottom.template = value; E:StaticPopup_Show("PRIVATE_RL") end,
-			values = {
-				['Default'] = L["Default"],
-				['Transparent'] = L["Transparent"],
+
+--Subgroups
+for k,v in pairs(drop) do
+	E.Options.args.sle.args.backgrounds.args[v[1]] = {
+		type = "group",
+		name = L[k],
+		order = v[2],
+		get = function(info) return E.db.sle.backgrounds[v[1]][ info[#info] ] end,
+		disabled = function() return not E.db.sle.backgrounds[v[1]].enabled end,
+		args = {
+			width = { --setting width (obviously)
+				order = 1,
+				type = "range",
+				name = L['Width'],
+				desc = L["Sets width of the frame"],
+				min = v[3], max = E.screenwidth, step = 1,
+				set = function(info, value) E.db.sle.backgrounds[v[1]].width = value; BG:FramesSize() end,
 			},
-		},
-		pethide = {
-			order = 10,
-			type = "toggle",
-			name = L["Hide in Pet Batlle"],
-			desc = L["Show/Hide this frame during Pet Battles."],
-			get = function(info) return E.db.sle.backgrounds.bottom.pethide end,
-			set = function(info, value) E.db.sle.backgrounds.bottom.pethide = value; BG:RegisterHide() end
-		},
-	},
-}
---Subgroup for 2nd frame
-E.Options.args.sle.args.backgrounds.args.left = {
-	order = 2,
-	type = "group",
-	name = L["Left BG"],
-	disabled = function() return not E.db.sle.backgrounds.left.enabled end,
-	args = {
-		width = {
-			order = 3,
-			type = "range",
-			name = L['Width'],
-			desc = L["Sets width of the frame"],
-			min = 150, max = E.screenwidth, step = 1,
-			get = function(info) return E.db.sle.backgrounds.left.width end,
-			set = function(info, value) E.db.sle.backgrounds.left.width = value; BG:FramesSize() end,
-		},
-		height = {
-			order = 4,
-			type = "range",
-			name = L['Height'],
-			desc = L["Sets height of the frame"],
-			min = 50, max = E.screenheight/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.left.height end,
-			set = function(info, value) E.db.sle.backgrounds.left.height = value; BG:FramesSize() end,
-		},
-		spacer = {
-			order = 5,
-			type = "description",
-			name = "",
-		},
-		xoffset = {
-			order = 6,
-			type = "range",
-			name = L['X Offset'],
-			desc = L["Sets X offset of the frame"],
-			min = -E.screenwidth/2, max = E.screenwidth/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.left.xoffset end,
-			set = function(info, value) E.db.sle.backgrounds.left.xoffset = value; BG:FramesPositions() end,
-		},
-		yoffset = {
-			order = 7,
-			type = "range",
-			name = L['Y Offset'],
-			desc = L["Sets Y offset of the frame"],
-			min = -21, max = E.screenheight, step = 1,
-			get = function(info) return E.db.sle.backgrounds.left.yoffset end,
-			set = function(info, value) E.db.sle.backgrounds.left.yoffset = value; BG:FramesPositions() end,
-		},
-		texture = {
-			order = 8,
-			type = 'input',
-			width = 'full',
-			name = L["Texture"],
-			desc = L["Set the texture to use in this frame.  Requirements are the same as the chat textures."],
-			get = function(info) return E.db.sle.backgrounds.left.texture end,
-			set = function(info, value)
-				E.db.sle.backgrounds.left.texture = value
-				E:UpdateMedia()
-				BG:UpdateTex()
-			end,
-		},
-		template = {
-			order = 9,
-			type = "select",
-			name = L["Backdrop Template"],
-			desc = L["Change the template used for this backdrop."],
-			get = function(info) return E.private.sle.backgrounds.left.template end,
-			set = function(info, value) E.private.sle.backgrounds.left.template = value; E:StaticPopup_Show("PRIVATE_RL") end,
-			values = {
-				['Default'] = L["Default"],
-				['Transparent'] = L["Transparent"],
+			height = {
+				order = 2,
+				type = "range",
+				name = L['Height'],
+				desc = L["Sets height of the frame"],
+				min = 50, max = E.screenheight/2, step = 1,
+				set = function(info, value) E.db.sle.backgrounds[v[1]].height = value; BG:FramesSize() end,
 			},
-		},
-		pethide = {
-			order = 10,
-			type = "toggle",
-			name = L["Hide in Pet Batlle"],
-			desc = L["Show/Hide this frame during Pet Battles."],
-			get = function(info) return E.db.sle.backgrounds.left.pethide end,
-			set = function(info, value) E.db.sle.backgrounds.left.pethide = value; BG:RegisterHide() end
-		},
-	},
-}
---Subgroup for 3rd frame
-E.Options.args.sle.args.backgrounds.args.right = {
-	order = 2,
-	type = "group",
-	name = L["Right BG"],
-	disabled = function() return not E.db.sle.backgrounds.right.enabled end,
-	args = {
-		width = {
-			order = 3,
-			type = "range",
-			name = L['Width'],
-			desc = L["Sets width of the frame"],
-			min = 150, max = E.screenwidth, step = 1,
-			get = function(info) return E.db.sle.backgrounds.right.width end,
-			set = function(info, value) E.db.sle.backgrounds.right.width = value; BG:FramesSize() end,
-		},
-		height = {
-			order = 4,
-			type = "range",
-			name = L['Height'],
-			desc = L["Sets height of the frame"],
-			min = 50, max = E.screenheight/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.right.height end,
-			set = function(info, value) E.db.sle.backgrounds.right.height = value; BG:FramesSize() end,
-		},
-		spacer = {
-			order = 5,
-			type = "description",
-			name = "",
-		},
-		xoffset = {
-			order = 6,
-			type = "range",
-			name = L['X Offset'],
-			desc = L["Sets X offset of the frame"],
-			min = -E.screenwidth/2, max = E.screenwidth/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.right.xoffset end,
-			set = function(info, value) E.db.sle.backgrounds.right.xoffset = value; BG:FramesPositions() end,
-		},
-		yoffset = {
-			order = 7,
-			type = "range",
-			name = L['Y Offset'],
-			desc = L["Sets Y offset of the frame"],
-			min = -21, max = E.screenheight, step = 1,
-			get = function(info) return E.db.sle.backgrounds.right.yoffset end,
-			set = function(info, value) E.db.sle.backgrounds.right.yoffset = value; BG:FramesPositions() end,
-		},
-		texture = {
-			order = 8,
-			type = 'input',
-			width = 'full',
-			name = L["Texture"],
-			desc = L["Set the texture to use in this frame.  Requirements are the same as the chat textures."],
-			get = function(info) return E.db.sle.backgrounds.right.texture end,
-			set = function(info, value)
-				E.db.sle.backgrounds.right.texture = value
-				E:UpdateMedia()
-				BG:UpdateTex()
-			end,
-		},
-		template = {
-			order = 9,
-			type = "select",
-			name = L["Backdrop Template"],
-			desc = L["Change the template used for this backdrop."],
-			get = function(info) return E.private.sle.backgrounds.right.template end,
-			set = function(info, value) E.private.sle.backgrounds.right.template = value; E:StaticPopup_Show("PRIVATE_RL") end,
-			values = {
-				['Default'] = L["Default"],
-				['Transparent'] = L["Transparent"],
+			spacer = { --Empty slot for making sliders move to next line
+				order = 3,
+				type = "description",
+				name = "",
 			},
-		},
-		pethide = {
-			order = 10,
-			type = "toggle",
-			name = L["Hide in Pet Batlle"],
-			desc = L["Show/Hide this frame during Pet Battles."],
-			get = function(info) return E.db.sle.backgrounds.right.pethide end,
-			set = function(info, value) E.db.sle.backgrounds.right.pethide = value; BG:RegisterHide() end
-		},
-	},
-}
---Subgroup for 4th frame
-E.Options.args.sle.args.backgrounds.args.action = {
-	order = 4,
-	type = "group",
-	name = L["Actionbar BG"],
-	disabled = function() return not E.db.sle.backgrounds.action.enabled end,
-	args = {
-		width = {
-			order = 3,
-			type = "range",
-			name = L['Width'],
-			desc = L["Sets width of the frame"],
-			min = 200, max = E.screenwidth, step = 1,
-			get = function(info) return E.db.sle.backgrounds.action.width end,
-			set = function(info, value) E.db.sle.backgrounds.action.width = value; BG:FramesSize() end,
-		},
-		height = {
-			order = 4,
-			type = "range",
-			name = L['Height'],
-			desc = L["Sets height of the frame"],
-			min = 50, max = E.screenheight/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.action.height end,
-			set = function(info, value) E.db.sle.backgrounds.action.height = value; BG:FramesSize() end,
-		},
-		spacer = {
-			order = 5,
-			type = "description",
-			name = "",
-		},
-		xoffset = {
-			order = 6,
-			type = "range",
-			name = L['X Offset'],
-			desc = L["Sets X offset of the frame"],
-			min = -E.screenwidth/2, max = E.screenwidth/2, step = 1,
-			get = function(info) return E.db.sle.backgrounds.action.xoffset end,
-			set = function(info, value) E.db.sle.backgrounds.action.xoffset = value; BG:FramesPositions() end,
-		},
-		yoffset = {
-			order = 7,
-			type = "range",
-			name = L['Y Offset'],
-			desc = L["Sets Y offset of the frame"],
-			min = -21, max = E.screenheight, step = 1,
-			get = function(info) return E.db.sle.backgrounds.action.yoffset end,
-			set = function(info, value) E.db.sle.backgrounds.action.yoffset = value; BG:FramesPositions() end,
-		},
-		texture = {
-			order = 8,
-			type = 'input',
-			width = 'full',
-			name = L["Texture"],
-			desc = L["Set the texture to use in this frame.  Requirements are the same as the chat textures."],
-			get = function(info) return E.db.sle.backgrounds.action.texture end,
-			set = function(info, value)
-				E.db.sle.backgrounds.action.texture = value
-				E:UpdateMedia()
-				BG:UpdateTex()
-			end,
-		},
-		template = {
-			order = 9,
-			type = "select",
-			name = L["Backdrop Template"],
-			desc = L["Change the template used for this backdrop."],
-			get = function(info) return E.private.sle.backgrounds.action.template end,
-			set = function(info, value) E.private.sle.backgrounds.action.template = value; E:StaticPopup_Show("PRIVATE_RL") end,
-			values = {
-				['Default'] = L["Default"],
-				['Transparent'] = L["Transparent"],
+			xoffset = {
+				order = 4,
+				type = "range",
+				name = L['X Offset'],
+				desc = L["Sets X offset of the frame"],
+				min = -E.screenwidth/2, max = E.screenwidth/2, step = 1,
+				set = function(info, value) E.db.sle.backgrounds[v[1]].xoffset = value; BG:FramesPositions() end,
+			},
+			yoffset = {
+				order = 5,
+				type = "range",
+				name = L['Y Offset'],
+				desc = L["Sets Y offset of the frame"],
+				min = -21, max = E.screenheight, step = 1,
+				set = function(info, value) E.db.sle.backgrounds[v[1]].yoffset = value; BG:FramesPositions() end,
+			},
+			--Setting custom texture for those who like it
+			texture = {
+				order = 6,
+				type = 'input',
+				width = 'full',
+				name = L["Texture"],
+				desc = L["Set the texture to use in this frame.  Requirements are the same as the chat textures."],
+				set = function(info, value)
+					E.db.sle.backgrounds[v[1]].texture = value
+					E:UpdateMedia()
+					BG:UpdateTex()
+				end,
+			},
+			template = {
+				order = 7,
+				type = "select",
+				name = L["Backdrop Template"],
+				desc = L["Change the template used for this backdrop."],
+				get = function(info) return E.private.sle.backgrounds[v[1]].template end,
+				set = function(info, value) E.private.sle.backgrounds[v[1]].template = value; E:StaticPopup_Show("PRIVATE_RL") end,
+				values = {
+					['Default'] = L["Default"],
+					['Transparent'] = L["Transparent"],
+				},
+			},
+			pethide = {
+				order = 8,
+				type = "toggle",
+				name = L["Hide in Pet Batlle"],
+				desc = L["Show/Hide this frame during Pet Battles."],
+				set = function(info, value) E.db.sle.backgrounds[v[1]].pethide = value; BG:RegisterHide() end
 			},
 		},
-		pethide = {
-			order = 10,
-			type = "toggle",
-			name = L["Hide in Pet Batlle"],
-			desc = L["Show/Hide this frame during Pet Battles."],
-			get = function(info) return E.db.sle.backgrounds.action.pethide end,
-			set = function(info, value) E.db.sle.backgrounds.action.pethide = value; BG:RegisterHide() end
-		},
-	},
-}
-
+	}
+end