Quantcast

Datatext defaults change

Darthpred [07-05-12 - 10:13]
Datatext defaults change

No more default for Top Panel
Added Location Plus defaults support
Filename
ElvUI_SLE/ElvUI_SLE.lua
ElvUI_SLE/config/profile.lua
ElvUI_SLE/core/install.lua
ElvUI_SLE/modules/datatexts/options.lua
diff --git a/ElvUI_SLE/ElvUI_SLE.lua b/ElvUI_SLE/ElvUI_SLE.lua
index 8d20cd2..6bfe2aa 100644
--- a/ElvUI_SLE/ElvUI_SLE.lua
+++ b/ElvUI_SLE/ElvUI_SLE.lua
@@ -11,6 +11,11 @@ function SLE:Initialize()
 		print(L['SLE_LOGIN_MSG'])
 	end
 	E:GetModule('Chat'):SetTimer() --If called before Edit loaded from chat.lua will cause errors
+	E.db.datatexts.panels.Top_Center = 'Version'
+	if IsAddOnLoaded("ElvUI_LocPlus") and not E:HasMoverBeenMoved('LocationMover') then
+		if not E.db.movers then E.db.movers = {}; end
+		E.db.movers.LocationMover = "TOPUIParentTOP0-18"
+	end
 end

 --Updating things that must be updated only after everything loads
@@ -37,6 +42,7 @@ function E:UpdateAll()
 	E:GetModule('DTPanels'):Update()
 	E:GetModule('UnitFrames'):Update_CombatIndicator()
 	E:GetModule('UIButtons'):Start()
+	E.db.datatexts.panels.Top_Center = 'Version'
 end

 E:RegisterModule(SLE:GetName())
\ No newline at end of file
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index 551ae03..3c9381f 100644
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -211,6 +211,7 @@ P.chat.editboxhistory = 5
 P.auras.perRow = 19

 --Datatexts
+if IsAddOnLoaded("ElvUI_LocPlus") then
 P['datatexts'] = {
 	['panels'] = {
 		['LeftChatDataPanel'] = {
@@ -253,15 +254,68 @@ P['datatexts'] = {
 			['middle'] = 'Haste',
 			['right'] = 'Crit Chance',
 		},
-		['Top_Center'] = 'Version',
 		['Bottom_Panel'] = 'System',
 		['LeftMiniPanel'] = 'Guild',
 		['RightMiniPanel'] = 'Friends',
+		['RightCoordDtPanel'] = 'System', --LocPlus
+		['LeftCoordDtPanel'] = 'Durability', --LocPlus
 	},
 	['localtime'] = true,
 	['time24'] = false,
 	['battleground'] = true,
 }
+else
+P['datatexts'] = {
+	['panels'] = {
+		['LeftChatDataPanel'] = {
+			['left'] = 'Armor',
+			['middle'] = 'Durability',
+			['right'] = 'Avoidance',
+		},
+		['RightChatDataPanel'] = {
+			['left'] = 'System',
+			['middle'] = 'Time',
+			['right'] = 'Gold',
+		},
+		['DP_1'] = {
+			['left'] = 'Swatter',
+			['middle'] = 'Skada',
+			['right'] = 'MrtWoo',
+		},
+		['DP_2'] = {
+			['left'] = 'Altoholic',
+			['middle'] = 'TellMeWhen',
+			['right'] = 'AtlasLoot',
+		},
+		['DP_3'] = {
+			['left'] = 'Notes',
+			['middle'] = 'DBM-LDB',
+			['right'] = 'WIM',
+		},
+		['DP_4'] = {
+			['left'] = '',
+			['middle'] = '',
+			['right'] = '',
+		},
+		['DP_5'] = {
+			['left'] = 'Bags',
+			['middle'] = 'Gold',
+			['right'] = 'Armor',
+		},
+		['DP_6'] = {
+			['left'] = 'Spell/Heal Power',
+			['middle'] = 'Haste',
+			['right'] = 'Crit Chance',
+		},
+		['Bottom_Panel'] = 'System',
+		['LeftMiniPanel'] = 'Guild',
+		['RightMiniPanel'] = 'Friends',
+	},
+	['localtime'] = true,
+	['time24'] = false,
+	['battleground'] = true,
+}
+end

 P.unitframe.units.player.classbar.xOffset = 0
 P.unitframe.units.player.classbar.yOffset = 0
diff --git a/ElvUI_SLE/core/install.lua b/ElvUI_SLE/core/install.lua
index 8363b25..083ecaa 100644
--- a/ElvUI_SLE/core/install.lua
+++ b/ElvUI_SLE/core/install.lua
@@ -789,6 +789,11 @@ function E:DarthSetup() --The function to switch from classic ElvUI settings to
 	end
 	--Ticket frame
 	E.db.movers.GMMover = "TOPRIGHTBNETMoverBOTTOMRIGHT0-10"
+
+	--Location Plus Mover >_>
+	if IsAddOnLoaded("ElvUI_LocPlus") then
+		E.db.movers.LocationMover = "TOPUIParentTOP0-18"
+	end

 	E:UpdateAll(true)
 end
@@ -1119,6 +1124,10 @@ function E:ElvSetup() --The function to restore defaults. not finished yet lol
 	--Move every bar and panel to the defaults.
 	E:ResetUI() --Reseting positions
 	StaticPopup3Button1:Click() --this is automatic click on confirm for reseting movers
+	if IsAddOnLoaded("ElvUI_LocPlus") then
+		if not E.db.movers then E.db.movers = {}; end
+		E.db.movers.LocationMover = "TOPUIParentTOP0-18"
+	end

 	E:UpdateAll(true)
 end
@@ -1300,7 +1309,9 @@ local function PreviousPage()
 end

 --Install UI
-function E:Install()
+function E:Install()
+	E.db.datatexts.panels.Top_Center = 'Version'
+	E:GetModule('DataTexts'):LoadDataTexts()
 	if not InstallStepComplete then
 		local imsg = CreateFrame("Frame", "InstallStepComplete", E.UIParent)
 		imsg:Size(418, 72)
diff --git a/ElvUI_SLE/modules/datatexts/options.lua b/ElvUI_SLE/modules/datatexts/options.lua
index c060f76..61653fd 100644
--- a/ElvUI_SLE/modules/datatexts/options.lua
+++ b/ElvUI_SLE/modules/datatexts/options.lua
@@ -1,5 +1,50 @@
 local E, L, V, P, G =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB
 local DTP = E:GetModule('DTPanels')
+local DT = E:GetModule('DataTexts')
+
+local datatexts = {}
+
+function DT:PanelLayoutOptions()
+	for name, _ in pairs(DT.RegisteredDataTexts) do
+		if name ~= 'Version' then
+			datatexts[name] = name
+		end
+	end
+	datatexts[''] = ''
+
+	local table = E.Options.args.datatexts.args.panels.args
+	local i = 0
+	for pointLoc, tab in pairs(P.datatexts.panels) do
+		i = i + 1
+		if not _G[pointLoc] then table[pointLoc] = nil; return; end
+		if type(tab) == 'table' then
+			table[pointLoc] = {
+				type = 'group',
+				args = {},
+				name = L[pointLoc] or pointLoc,
+				guiInline = true,
+				order = i + -10,
+			}
+			for option, value in pairs(tab) do
+				table[pointLoc].args[option] = {
+					type = 'select',
+					name = L[option] or option:upper(),
+					values = datatexts,
+					get = function(info) return E.db.datatexts.panels[pointLoc][ info[#info] ] end,
+					set = function(info, value) E.db.datatexts.panels[pointLoc][ info[#info] ] = value; DT:LoadDataTexts() end,
+				}
+			end
+		elseif type(tab) == 'string' then
+			table[pointLoc] = {
+				type = 'select',
+				name = L[pointLoc] or pointLoc,
+				values = datatexts,
+				get = function(info) return E.db.datatexts.panels[pointLoc] end,
+				set = function(info, value) E.db.datatexts.panels[pointLoc] = value; DT:LoadDataTexts() end,
+			}
+		end
+	end
+end

 --Datatext panels
 E.Options.args.sle.args.datatext = {