Quantcast

Datatexts core

Darthpred [07-11-14 - 20:32]
Datatexts core
Filename
ElvUI_SLE/modules/datatexts.lua
ElvUI_SLE/options/datatexts_c.lua
diff --git a/ElvUI_SLE/modules/datatexts.lua b/ElvUI_SLE/modules/datatexts.lua
index 863f010..cab8dd6 100644
--- a/ElvUI_SLE/modules/datatexts.lua
+++ b/ElvUI_SLE/modules/datatexts.lua
@@ -25,29 +25,15 @@ local panels = {
 	Bottom_Panel = {"bottom", "Bottom_Panel", "BOTTOM", 0, Bottom_Panel, 1},
 }

---Added function to create new panels
-LO.InitializeSLE = LO.Initialize
-function LO:Initialize()
-	LO.InitializeSLE(self)
-	for _,v in pairs(panels) do
-		DTP:CreateDataPanels(v[5], v[2], v[3], v[4], v[6], v[1])
-	end
-	DTP:Resize()
-
-	for _,v in pairs(panels) do
-		E:CreateMover(v[5], v[2].."_Mover", L[v[2]], nil, nil, nil, "ALL,S&L,S&L DT")
-	end
-end
-
 -- New panels
-function DTP:CreateDataPanels(panel, name, point, x, slot, short)
+local function CreateDataPanels(panel, name, point, x, slot, short)
 	panel:SetFrameStrata('LOW')
 	panel:Point(point, E.UIParent, point, x, 0);
 	DT:RegisterPanel(panel, slot, 'ANCHOR_BOTTOM', 0, -4)
 	panel:Hide()
 end

-function DTP:Resize()
+local function PanelResize()
 	local db = E.db.sle.datatext
 	for _,v in pairs(panels) do
 		v[5]:Size(db[v[1]].width, 20)
@@ -55,6 +41,20 @@ function DTP:Resize()
 	DT:UpdateAllDimensions()
 end

+--Added function to create new panels
+LO.InitializeSLE = LO.Initialize
+function LO:Initialize()
+	LO.InitializeSLE(self)
+	for _,v in pairs(panels) do
+		CreateDataPanels(v[5], v[2], v[3], v[4], v[6], v[1])
+	end
+	PanelResize()
+
+	for _,v in pairs(panels) do
+		E:CreateMover(v[5], v[2].."_Mover", L[v[2]], nil, nil, nil, "ALL,S&L,S&L DT")
+	end
+end
+
 function DTP:ChatResize()
 	LeftChatDataPanel:Point('TOPRIGHT', LeftChatPanel, 'BOTTOMLEFT', 16 + E.db.sle.datatext.chatleft.width, (E.PixelMode and 1 or -1))
 	RightChatDataPanel:Point('BOTTOMLEFT', RightChatPanel, 'BOTTOMRIGHT', - E.db.sle.datatext.chatright.width - 16, (E.PixelMode and -19 or -21))
@@ -81,7 +81,7 @@ end

 function DTP:Update()
 	DTP:ExtraDataBarSetup()
-	DTP:Resize()
+	PanelResize()
 end

 function DTP:RegisterHide()
@@ -103,5 +103,5 @@ function DTP:PLAYER_ENTERING_WORLD(...)
 end

 function DTP:Initialize()
-	DTP:RegisterEvent('PLAYER_ENTERING_WORLD')
+	self:RegisterEvent('PLAYER_ENTERING_WORLD')
 end
\ No newline at end of file
diff --git a/ElvUI_SLE/options/datatexts_c.lua b/ElvUI_SLE/options/datatexts_c.lua
index ef3d539..261e977 100644
--- a/ElvUI_SLE/options/datatexts_c.lua
+++ b/ElvUI_SLE/options/datatexts_c.lua
@@ -107,7 +107,7 @@ E.Options.args.sle.args.datatext.args.panels.args[v[1]] = {
 			desc = L["Sets size of this panel"],
 			disabled = function() return not E.db.sle.datatext[v[1]].enabled end,
 			min = 100 * v[3], max = E.screenwidth/2, step = 1,
-			set = function(info, value) E.db.sle.datatext[v[1]].width = value; DTP:Resize() end,
+			set = function(info, value) E.db.sle.datatext[v[1]].width = value; DTP:Update() end,
 		},
 		hide = {
 			order = 3,