Quantcast

Woot. New options

Darthpred [07-12-14 - 21:29]
Woot. New options
Filename
ElvUI_SLE/core/core.lua
ElvUI_SLE/defaults/private.lua
ElvUI_SLE/options/load_options.xml
ElvUI_SLE/options/media_c.lua
diff --git a/ElvUI_SLE/core/core.lua b/ElvUI_SLE/core/core.lua
index e6ad0db..44f0106 100644
--- a/ElvUI_SLE/core/core.lua
+++ b/ElvUI_SLE/core/core.lua
@@ -2,6 +2,7 @@
 local SLE = E:GetModule('SLE')
 local EP = LibStub("LibElvUIPlugin-1.0")
 local UF = E:GetModule('UnitFrames')
+local LSM = LibStub("LibSharedMedia-3.0")
 local addon = ...

 --localizing functions--
@@ -62,6 +63,17 @@ local function CheckIncompatible()
 	end
 end

+local function SetFonts()
+	local zoneFont = LSM:Fetch('font', E.global.sle.fonts.zone.font)
+	local zoneSize = E.global.sle.fonts.zone.size
+	local zoneOutline = E.global.sle.fonts.zone.outline
+	local subzoneFont = LSM:Fetch('font', E.global.sle.fonts.subzone.font)
+	local subzoneSize = E.global.sle.fonts.subzone.size
+	local subzoneOutline = E.global.sle.fonts.subzone.outline
+	ZoneTextString:SetFont(zoneFont, zoneSize, zoneOutline)
+	SubZoneTextString:SetFont(subzoneFont, subzoneSize, subzoneOutline)
+end
+
 function SLE:Initialize()
 	--ElvUI's version check
 	if elvV < elvR then
@@ -79,4 +91,7 @@ function SLE:Initialize()
 	ConfigCats()
 	SLE:RegisterCommands()
 	CheckIncompatible()
+	if E.global.sle.fonts.enable then
+		hooksecurefunc(E, "UpdateBlizzardFonts", SetFonts)
+	end
 end
\ No newline at end of file
diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua
index a9157fe..e19dc31 100644
--- a/ElvUI_SLE/defaults/private.lua
+++ b/ElvUI_SLE/defaults/private.lua
@@ -2,6 +2,7 @@
 V['skins']['addons'] = {
 	['EmbedSkada'] = true,
 }
+
 V['sle'] = {

 	--Character Frame Options
@@ -69,3 +70,19 @@ V['sle'] = {
 	['guildmaster'] = false,
 	['backgrounds'] = false,
 }
+
+G['sle'] = {
+	['fonts'] = {
+		['enable'] = false,
+		['zone'] = {
+			['font'] = "ElvUI Font",
+			['size'] = 32,
+			['outline'] = "OUTLINE",
+		},
+		['subzone'] = {
+			['font'] = "ElvUI Font",
+			['size'] = 25,
+			['outline'] = "OUTLINE",
+		},
+	},
+}
\ No newline at end of file
diff --git a/ElvUI_SLE/options/load_options.xml b/ElvUI_SLE/options/load_options.xml
index 7817d03..8864c2a 100644
--- a/ElvUI_SLE/options/load_options.xml
+++ b/ElvUI_SLE/options/load_options.xml
@@ -1,6 +1,7 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/">
 	<Script file='core_c.lua'/>
 	<Script file='help_c.lua'/>
+	<Script file='media_c.lua'/>
 	<Script file='autorelease_c.lua'/>
 	<Script file='datatexts_c.lua'/>
 	<Script file='backgrounds_c.lua'/>
diff --git a/ElvUI_SLE/options/media_c.lua b/ElvUI_SLE/options/media_c.lua
new file mode 100644
index 0000000..6b5dc2e
--- /dev/null
+++ b/ElvUI_SLE/options/media_c.lua
@@ -0,0 +1,124 @@
+local E, L, V, P, G, _ = unpack(ElvUI);
+local function configTable()
+
+E.Options.args.sle.args.media = {
+	type = "group",
+    name = L["Media"],
+    order = 3,
+	args = {
+		header = {
+			order = 1,
+			type = "header",
+			name = L["Media"],
+		},
+		intro = {
+			order = 2,
+			type = "description",
+			name = "Imma text!",
+		},
+		fonts = {
+			type = "group",
+			name = L["Fonts"],
+			order = 3,
+			guiInline = true,
+			args = {
+				intro = {
+					order = 1,
+					type = "description",
+					name = "Enables replacement of some fonts. Please note that these options will take effect only after reload of your UI.",
+				},
+				enable = {
+					order = 2,
+					type = "toggle",
+					name = L["Enable"],
+					get = function(info) return E.global.sle.fonts.enable end,
+					set = function(info, value) E.global.sle.fonts.enable = value; E:StaticPopup_Show("GLOBAL_RL") end
+				},
+				zone = {
+					type = "group",
+					name = "Zone Text",
+					order = 3,
+					guiInline = true,
+					disabled = function() return not E.global.sle.fonts.enable end,
+					args = {
+						font = {
+							type = "select", dialogControl = 'LSM30_Font',
+							order = 1,
+							name = L["Default Font"],
+							values = AceGUIWidgetLSMlists.font,
+							get = function(info) return E.global.sle.fonts.zone.font end,
+							set = function(info, value) E.global.sle.fonts.zone.font = value; E:StaticPopup_Show("GLOBAL_RL") end,
+						},
+						size = {
+							order = 2,
+							name = L["Font Size"],
+							type = "range",
+							min = 6, max = 48, step = 1,
+							get = function(info) return E.global.sle.fonts.zone.size end,
+							set = function(info, value) E.global.sle.fonts.zone.size = value; E:StaticPopup_Show("GLOBAL_RL") end,
+						},
+						outline = {
+							order = 3,
+							name = L["Font Outline"],
+							desc = L["Set the font outline."],
+							type = "select",
+							get = function(info) return E.global.sle.fonts.zone.outline end,
+							set = function(info, value) E.global.sle.fonts.zone.outline = value; E:StaticPopup_Show("GLOBAL_RL") end,
+							values = {
+								['NONE'] = L['None'],
+								['OUTLINE'] = 'OUTLINE',
+
+								['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
+								['THICKOUTLINE'] = 'THICKOUTLINE',
+							},
+						},
+					},
+				},
+				subzone = {
+					type = "group",
+					name = "Subzone Text",
+					order = 4,
+					guiInline = true,
+					disabled = function() return not E.global.sle.fonts.enable end,
+					args = {
+						font = {
+							type = "select", dialogControl = 'LSM30_Font',
+							order = 1,
+							name = L["Default Font"],
+							values = AceGUIWidgetLSMlists.font,
+							get = function(info) return E.global.sle.fonts.subzone.font end,
+							set = function(info, value) E.global.sle.fonts.subzone.font = value; E:StaticPopup_Show("GLOBAL_RL") end,
+						},
+						size = {
+							order = 2,
+							name = L["Font Size"],
+							type = "range",
+							min = 6, max = 48, step = 1,
+							get = function(info) return E.global.sle.fonts.subzone.size end,
+							set = function(info, value) E.global.sle.fonts.subzone.size = value; E:StaticPopup_Show("GLOBAL_RL") end,
+						},
+						outline = {
+							order = 3,
+							name = L["Font Outline"],
+							desc = L["Set the font outline."],
+							type = "select",
+							get = function(info) return E.global.sle.fonts.subzone.outline end,
+							set = function(info, value) E.global.sle.fonts.subzone.outline = value; E:StaticPopup_Show("GLOBAL_RL") end,
+							values = {
+								['NONE'] = L['None'],
+								['OUTLINE'] = 'OUTLINE',
+
+								['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
+								['THICKOUTLINE'] = 'THICKOUTLINE',
+							},
+						},
+					},
+				},
+			},
+		},
+	},
+}
+
+end
+
+table.insert(E.SLEConfigs, configTable)
\ No newline at end of file