Quantcast

fix

Steven Jackson [07-21-14 - 02:08]
fix
Filename
Interface/AddOns/SVUI/packages/dock/SVDock.lua
Interface/AddOns/SVUI/system/classes/Database.lua
Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua
diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua
index 12087a1..4fd2176 100644
--- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua
+++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua
@@ -12,18 +12,31 @@ _____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_       #
 ##############################################################################
 S U P E R - V I L L A I N - U I   By: Munglunch                              #
 ##############################################################################
---]]
-local SuperVillain, L = unpack(select(2, ...));
-local MOD = {}
---[[
 ##########################################################
-LOCAL VARS
+LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
+--[[ GLOBALS ]]--
+local _G = _G;
+local unpack    = _G.unpack;
+local select    = _G.select;
+local pairs     = _G.pairs;
+local type      = _G.type;
+local math      = _G.math;
+local table 	= _G.table;
+--[[ MATH METHODS ]]--
+local min = math.min;
 local tinsert, wipe, pairs, ipairs, unpack, pcall, select = tinsert, table.wipe, pairs, ipairs, unpack, pcall, select;
 local format, gsub, strfind, strmatch, tonumber = format, gsub, strfind, strmatch, tonumber;
 --[[
 ##########################################################
+GET ADDON DATA
+##########################################################
+]]--
+local SuperVillain, L = unpack(select(2, ...));
+local MOD = {}
+--[[
+##########################################################
 PRE VARS/FUNCTIONS
 ##########################################################
 ]]--
@@ -140,13 +153,13 @@ CORE FUNCTIONS
 ##########################################################
 ]]--
 function MOD:UpdateSuperDock()
-	local leftWidth = MOD.db.dockLeftWidth or 350;
-	local leftHeight = MOD.db.dockLeftHeight or 180;
-	local rightWidth = MOD.db.dockRightWidth or 350;
-	local rightHeight = MOD.db.dockRightHeight or 180;
-	local buttonsize = MOD.db.buttonSize or 22;
-	local spacing = MOD.db.buttonSpacing or 4;
-	local statBarWidth = (SVUI_Cache.screenwidth - (leftWidth + rightWidth)) - (SuperVillain:Scale(80))
+	local leftWidth = self.db.dockLeftWidth or 350;
+	local leftHeight = self.db.dockLeftHeight or 180;
+	local rightWidth = self.db.dockRightWidth or 350;
+	local rightHeight = self.db.dockRightHeight or 180;
+	local buttonsize = self.db.buttonSize or 22;
+	local spacing = self.db.buttonSpacing or 4;
+	local statBarWidth = self.db.dockStatWidth

 	_G["LeftSuperDock"]:Size(leftWidth, leftHeight)
 	_G["SuperDockAlertLeft"]:Width(leftWidth)
@@ -158,21 +171,21 @@ function MOD:UpdateSuperDock()
 	_G["BottomLeftDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8)
 	_G["BottomRightDataPanel"]:Size((statBarWidth * 0.5) - 1, buttonsize - 8)

-	MOD:BottomPanelVisibility();
-	MOD:TopPanelVisibility();
-	MOD:UpdateDockBackdrops();
-	MOD:ReloadDocklets()
+	self:BottomPanelVisibility();
+	self:TopPanelVisibility();
+	self:UpdateDockBackdrops();
+	self:ReloadDocklets()
 end

 function MOD:UpdateDockBackdrops()
-	if MOD.db.rightDockBackdrop then
+	if self.db.rightDockBackdrop then
 		RightSuperDock.backdrop:Show()
 		RightSuperDock.backdrop:ClearAllPoints()
 		RightSuperDock.backdrop:WrapOuter(RightSuperDock, 4, 4)
 	else
 		RightSuperDock.backdrop:Hide()
 	end
-	if MOD.db.leftDockBackdrop then
+	if self.db.leftDockBackdrop then
 		LeftSuperDock.backdrop:Show()
 		LeftSuperDock.backdrop:ClearAllPoints()
 		LeftSuperDock.backdrop:WrapOuter(LeftSuperDock, 4, 4)
@@ -182,18 +195,18 @@ function MOD:UpdateDockBackdrops()
 end

 function MOD:BottomPanelVisibility()
-	if MOD.db.bottomPanel then
-		MOD.BottomPanel:Show()
+	if self.db.bottomPanel then
+		self.BottomPanel:Show()
 	else
-		MOD.BottomPanel:Hide()
+		self.BottomPanel:Hide()
 	end
 end

 function MOD:TopPanelVisibility()
-	if MOD.db.topPanel then
-		MOD.TopPanel:Show()
+	if self.db.topPanel then
+		self.TopPanel:Show()
 	else
-		MOD.TopPanel:Hide()
+		self.TopPanel:Hide()
 	end
 end

@@ -220,12 +233,12 @@ function MOD:CreateSuperBorders()
 	TopPanel:SetBackdropBorderColor(0,0,0,1)
 	TopPanel:SetFrameLevel(0)
 	TopPanel:SetFrameStrata('BACKGROUND')
-	MOD.TopPanel = TopPanel;
-	MOD.TopPanel:SetScript("OnShow", function(self)
-		self:SetFrameLevel(0)
-		self:SetFrameStrata('BACKGROUND')
+	self.TopPanel = TopPanel;
+	self.TopPanel:SetScript("OnShow", function(this)
+		this:SetFrameLevel(0)
+		this:SetFrameStrata('BACKGROUND')
 	end)
-	MOD:TopPanelVisibility()
+	self:TopPanelVisibility()

 	local BottomPanel = CreateFrame("Frame", "SVUIBottomPanel", SuperVillain.UIParent)
 	BottomPanel:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", -1, -1)
@@ -243,10 +256,10 @@ function MOD:CreateSuperBorders()
 	BottomPanel:SetBackdropBorderColor(0,0,0,1)
 	BottomPanel:SetFrameLevel(0)
 	BottomPanel:SetFrameStrata('BACKGROUND')
-	MOD.BottomPanel = BottomPanel;
-	MOD.BottomPanel:SetScript("OnShow", function(self)
-		self:SetFrameLevel(0)
-		self:SetFrameStrata('BACKGROUND')
+	self.BottomPanel = BottomPanel;
+	self.BottomPanel:SetScript("OnShow", function(this)
+		this:SetFrameLevel(0)
+		this:SetFrameStrata('BACKGROUND')
 	end)
 	MOD:BottomPanelVisibility()
 end
@@ -261,14 +274,15 @@ end
 SuperVillain.Registry:SetCallback(BorderColorUpdates)

 function MOD:CreateDockPanels()
-	MOD.SuperDockFaded = SVUI_Cache["Dock"].SuperDockFaded
-	local leftWidth = MOD.db.dockLeftWidth or 350;
-	local leftHeight = MOD.db.dockLeftHeight or 180;
-	local rightWidth = MOD.db.dockRightWidth or 350;
-	local rightHeight = MOD.db.dockRightHeight or 180;
-	local buttonsize = MOD.db.buttonSize or 22;
-	local spacing = MOD.db.buttonSpacing or 4;
-	local statBarWidth = (SVUI_Cache.screenwidth - (leftWidth + rightWidth)) - (SuperVillain:Scale(80))
+	self.SuperDockFaded = SVUI_Cache["Dock"].SuperDockFaded
+
+	local leftWidth = self.db.dockLeftWidth or 350;
+	local leftHeight = self.db.dockLeftHeight or 180;
+	local rightWidth = self.db.dockRightWidth or 350;
+	local rightHeight = self.db.dockRightHeight or 180;
+	local buttonsize = self.db.buttonSize or 22;
+	local spacing = self.db.buttonSpacing or 4;
+	local statBarWidth = self.db.dockStatWidth
 	local STATS = SuperVillain.Registry:Expose("SVStats");

 	-- [[ CORNER BUTTON ]] --
diff --git a/Interface/AddOns/SVUI/system/classes/Database.lua b/Interface/AddOns/SVUI/system/classes/Database.lua
index 4bd4461..b508d3d 100644
--- a/Interface/AddOns/SVUI/system/classes/Database.lua
+++ b/Interface/AddOns/SVUI/system/classes/Database.lua
@@ -40,6 +40,7 @@ local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round;  --
 local fmod, modf, sqrt = math.fmod, math.modf, math.sqrt;   -- Algebra
 local atan2, cos, deg, rad, sin = math.atan2, math.cos, math.deg, math.rad, math.sin;  -- Trigonometry
 local parsefloat, huge, random = math.parsefloat, math.huge, math.random;  -- Uncommon
+local max = math.max;
 --[[ BINARY METHODS ]]--
 local band, bor = bit.band, bit.bor;
 --[[ TABLE METHODS ]]--
@@ -195,6 +196,10 @@ end
 DB PROFILE
 ##########################################################
 ]]--
+local rez = GetCVar("gxResolution");
+local gxWidth = tonumber(match(rez,"(%d+)x%d+"));
+local bw = gxWidth * 0.5
+local statBarWidth = max(bw, 600)
 local DatabaseDefaults = {
 	["copyKey"] = pkey,
 	["profileKey"] = pkey,
@@ -597,6 +602,7 @@ local DatabaseDefaults = {
 		["dockLeftHeight"] = 224,
 		["dockRightWidth"] = 412,
 		["dockRightHeight"] = 224,
+		["dockStatWidth"] = statBarWidth,
 		["buttonSize"] = 30,
 		["buttonSpacing"] = 4,
 		["leftDockBackdrop"] = true,
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua
index 0f2c03a..3e2b78c 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua
@@ -68,6 +68,17 @@ SuperVillain.Options.args.SVDock.args["common"] = {
 			get = function(j)return SuperVillain.db.SVDock.topPanel end,
 			set = function(key,value)MOD:ChangeDBVar(value,key[#key]);MOD:TopPanelVisibility()end
 		},
+		leftDockBackdrop = {
+			order = 3,
+			type = 'toggle',
+			name = L['Left Dock Backdrop'],
+			desc = L['Display a backdrop behind the left-side dock.'],
+			get = function(j)return SuperVillain.db.SVDock.leftDockBackdrop end,
+			set = function(key,value)
+				MOD:ChangeDBVar(value,key[#key]);
+				MOD:UpdateDockBackdrops()
+			end
+		},
 	}
 };

@@ -85,6 +96,7 @@ SuperVillain.Options.args.SVDock.args["leftDockGroup"] = {
 				min = 150,
 				max = 600,
 				step = 1,
+				width = "full",
 				get = function()return SuperVillain.db.SVDock.dockLeftHeight;end,
 				set = function(key,value)
 					MOD:ChangeDBVar(value,key[#key]);
@@ -100,6 +112,7 @@ SuperVillain.Options.args.SVDock.args["leftDockGroup"] = {
 				min = 150,
 				max = 700,
 				step = 1,
+				width = "full",
 				get = function()return SuperVillain.db.SVDock.dockLeftWidth;end,
 				set = function(key,value)
 					MOD:ChangeDBVar(value,key[#key]);
@@ -107,16 +120,20 @@ SuperVillain.Options.args.SVDock.args["leftDockGroup"] = {
 					CHAT:RefreshChatFrames(true)
 				end,
 			},
-			leftDockBackdrop = {
-				order = 3,
-				type = 'toggle',
-				name = L['Left Dock Backdrop'],
-				desc = L['Display a backdrop behind the left-side dock.'],
-				get = function(j)return SuperVillain.db.SVDock.leftDockBackdrop end,
+			dockStatWidth = {
+				order = 3,
+				type = "range",
+				name = L["Bottom Stats Width"],
+				desc = L["PANEL_DESC"],
+				min = 150,
+				max = 1200,
+				step = 1,
+				width = "full",
+				get = function()return SuperVillain.db.SVDock.dockStatWidth;end,
 				set = function(key,value)
 					MOD:ChangeDBVar(value,key[#key]);
-					MOD:UpdateDockBackdrops()
-				end
+					MOD:UpdateSuperDock(true)
+				end,
 			},
 		}
 	};