Quantcast

New module parameter: childGroup.

Scott Sibley [09-10-10 - 21:03]
New module parameter: childGroup.
Filename
Modules/Bars.lua
Modules/Histograms.lua
StarTip.lua
diff --git a/Modules/Bars.lua b/Modules/Bars.lua
index 8e0fdc2..c7c9c11 100644
--- a/Modules/Bars.lua
+++ b/Modules/Bars.lua
@@ -1,6 +1,7 @@
 local mod = StarTip:NewModule("Bars", "AceTimer-3.0")
 mod.name = "Bars"
 mod.toggled = true
+mod.childGroup = true
 local _G = _G
 local StarTip = _G.StarTip
 local GameTooltip = _G.GameTooltip
diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua
index 8567eca..e6a19ef 100644
--- a/Modules/Histograms.lua
+++ b/Modules/Histograms.lua
@@ -1,6 +1,7 @@
 local mod = StarTip:NewModule("Histograms", "AceTimer-3.0")
 mod.name = "Histograms"
 mod.toggled = true
+mod.childGroup = true
 local _G = _G
 local StarTip = _G.StarTip
 local GameTooltip = _G.GameTooltip
@@ -41,9 +42,23 @@ if mem then
     return memdiff / totaldiff * 100
 end
 ]],
+		color = [[
+local mem, percent, memdiff, totalMem, totaldiff = GetMemUsage("StarTip")
+if mem then
+    if totaldiff == 0 then totaldiff = 1 end
+    memperc = (memdiff / totaldiff * 100)
+	do return ColorGradient(memperc) end
+    local num = floor(memperc + 0.5)
+    if num < 1 then num = 1 end
+    if num > 100 then num = 100 end
+    local r, g, b = gradient[num][1], gradient[num][2], gradient[num][3]
+    return r, g, b
+end
+
+]],
 		min = "return 0",
 		max = "return 100",
-		enabled = true,
+		enabled = false,
 		reversed = true,
 		char = "0",
 		width = 10,
@@ -302,6 +317,14 @@ function mod:RebuildOpts()
 			type="group",
 			order = 6,
 			args={
+				enabled = {
+					name = "Enable",
+					desc = "Toggle whether this histogram is enabled or not",
+					type = "toggle",
+					get = function() return db.enabled end,
+					set = function(info, v) db.enabled = v end,
+					order = 1
+				},
 				height = {
 					name = "Histogram height",
 					desc = "Enter the histogram's height",
@@ -363,6 +386,7 @@ function mod:RebuildOpts()
 					name = "Anchor Points",
 					desc = "This histogram's anchor point. These arguments are passed to histogram:SetPoint()",
 					type = "input",
+					width = "full",
 					get = function() return db.point end,
 					set = function(info, v)
 						db.point = v;
diff --git a/StarTip.lua b/StarTip.lua
index 8fbce7d..677d20b 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -469,7 +469,7 @@ function StarTip:RebuildOpts()
 				type = "header",
 				order = 3
 			}
-			if v:GetName() == "Bars" then
+			if v.childGroup then
 				options.args.modules.args[v:GetName()].childGroups = "tab"
 			end
 		else