Quantcast

Change defaults back a bit. Let's not get carried away.

Scott Sibley [09-13-10 - 04:55]
Change defaults back a bit. Let's not get carried away.
Filename
Modules/Bars.lua
Modules/Histograms.lua
Modules/Text.lua
diff --git a/Modules/Bars.lua b/Modules/Bars.lua
index 373ef8c..c142ad4 100644
--- a/Modules/Bars.lua
+++ b/Modules/Bars.lua
@@ -2,7 +2,6 @@ local mod = StarTip:NewModule("Bars", "AceTimer-3.0")
 mod.name = "Bars"
 mod.toggled = true
 mod.childGroup = true
-mod.defaultOff = true
 local _G = _G
 local StarTip = _G.StarTip
 local GameTooltip = _G.GameTooltip
@@ -190,14 +189,13 @@ local strataNameList = {

 local strataLocaleList = {"Background", "Low", "Medium", "High", "Dialog", "Fullscreen", "Fullscreen Dialog", "Tooltip"}

-function clearBars()
-	for k, bar in pairs(mod.bars) do
-		for i, v in ipairs(bar.bars) do
-			del(v)
-		end
-		bar:Del()
+function clearBar(obj)
+	obj = mod.bars and mod.bars[obj]
+	if not obj then return end
+	for i, v in pairs(obj.bars) do
+		del(v)
 	end
-	wipe(mod.bars)
+	obj:Del()
 end

 function createBars()
@@ -405,7 +403,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.enabled = v
 						db["enabledDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 1
@@ -419,7 +417,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.height = tonumber(v);
 						db["heightDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars();
 					end,
 					order = 2
@@ -433,7 +431,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.update = tonumber(v);
 						db["updateDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 3
@@ -465,7 +463,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.texture1 = LSM:List("statusbar")[v]
 						db["texture1Dirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 4
@@ -481,7 +479,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.texture2 = LSM:List("statusbar")[v]
 						db["texture2Dirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars() end,
 					order = 5
 				},
@@ -490,7 +488,7 @@ function mod:RebuildOpts()
 					type = "select",
 					values = strataLocaleList,
 					get = function() return db.strata end,
-					set = function(info, v) db.strata = v; clearBars() end,
+					set = function(info, v) db.strata = v; clearBar(db) end,
 					order = 6
 				},
 				point = {
@@ -503,14 +501,14 @@ function mod:RebuildOpts()
 							type = "select",
 							values = anchors,
 							get = function() return anchorsDict[db.point[1] or 1] end,
-							set = function(info, v) db.point[1] = anchors[v]; clearBars() end,
+							set = function(info, v) db.point[1] = anchors[v]; clearBar(db) end,
 							order = 1
 						},
 						relativeFrame = {
 							name = "Relative Frame",
 							type = "input",
 							get = function() return db.point[2] end,
-							set = function(info, v) db.point[2] = v; clearBars() end,
+							set = function(info, v) db.point[2] = v; clearBar(db) end,
 							order = 2
 						},
 						relativePoint = {
@@ -518,7 +516,7 @@ function mod:RebuildOpts()
 							type = "select",
 							values = anchors,
 							get = function() return anchorsDict[db.point[3] or 1] end,
-							set = function(info, v) db.point[3] = anchors[v]; clearBars() end,
+							set = function(info, v) db.point[3] = anchors[v]; clearBar(db) end,
 							order = 3
 						},
 						xOfs = {
@@ -526,7 +524,7 @@ function mod:RebuildOpts()
 							type = "input",
 							pattern = "%d",
 							get = function() return tostring(db.point[4] or 0) end,
-							set = function(info, v) db.point[4] = tonumber(anchors[v]); clearBars() end,
+							set = function(info, v) db.point[4] = tonumber(anchors[v]); clearBar(db) end,
 							order = 4
 						},
 						yOfs = {
@@ -534,7 +532,7 @@ function mod:RebuildOpts()
 							type = "input",
 							pattern = "%d",
 							get = function() return tostring(db.point[5] or 0) end,
-							set = function(info, v) db.point[5] = tonumber(anchors[v]); clearBars() end,
+							set = function(info, v) db.point[5] = tonumber(anchors[v]); clearBar(db) end,
 							order = 4
 						}
 					},
@@ -548,7 +546,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.top = v;
 						db["topDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 8
@@ -563,7 +561,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.expression = v;
 						db["expressionDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 9
@@ -578,7 +576,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.expression2 = v ;
 						db["expressionDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 10
@@ -593,7 +591,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.min = v;
 						db["minDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 11
@@ -609,7 +607,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.max = v;
 						db["maxDirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 12
@@ -624,7 +622,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.color1 = v;
 						db["color1Dirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 13
@@ -639,7 +637,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.color2 = v;
 						db["color2Dirty"] = true
-						clearBars()
+						clearBar(db)
 						createBars()
 					end,
 					order = 13
diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua
index f5af830..797f258 100644
--- a/Modules/Histograms.lua
+++ b/Modules/Histograms.lua
@@ -2,6 +2,7 @@ local mod = StarTip:NewModule("Histograms", "AceTimer-3.0")
 mod.name = "Histograms"
 mod.toggled = true
 mod.childGroup = true
+mod.defaultOff = true
 local _G = _G
 local StarTip = _G.StarTip
 local GameTooltip = _G.GameTooltip
@@ -237,14 +238,13 @@ do
 	end
 end

-local function clearHistograms()
-	for k, v in pairs(mod.histograms) do
-		for i, v in pairs(v) do
-			del(v)
-			v:SetValue(0)
-		end
-		v:Del()
+local function clearHistogram(obj)
+	obj = mod.histograms and mod.histograms[obj]
+	if not obj then return end
+	for k, v in pairs(obj.bars) do
+		del(v)
 	end
+	obj:Del()
 end

 local function createHistograms()
@@ -448,7 +448,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.enabled = v
 						db["enabledDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 1
@@ -462,7 +462,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.height = tonumber(v);
 						db["heightDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms();
 					end,
 					order = 2
@@ -476,7 +476,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.width = tonumber(v)
 						db["widthDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 3
@@ -499,7 +499,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.update = tonumber(v);
 						db["updateDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 5
@@ -531,7 +531,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.texture = LSM:List("statusbar")[v]
 						db["textureDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 6
@@ -546,14 +546,14 @@ function mod:RebuildOpts()
 							type = "select",
 							values = anchors,
 							get = function() return anchorsDict[db.point[1] or 1] end,
-							set = function(info, v) db.point[1] = anchors[v];clearHistograms();createHistograms() end,
+							set = function(info, v) db.point[1] = anchors[v];clearHistogram(db);createHistograms() end,
 							order = 1
 						},
 						relativeFrame = {
 							name = "Relative Frame",
 							type = "input",
 							get = function() return db.point[2] end,
-							set = function(info, v) db.point[2] = v; clearHistograms(); createHistograms() end,
+							set = function(info, v) db.point[2] = v; clearHistogram(db); createHistograms() end,
 							order = 2
 						},
 						relativePoint = {
@@ -561,7 +561,7 @@ function mod:RebuildOpts()
 							type = "select",
 							values = anchors,
 							get = function() return anchorsDict[db.point[3] or 1] end,
-							set = function(info, v) db.point[3] = anchors[v]; clearHistograms(); createHistograms() end,
+							set = function(info, v) db.point[3] = anchors[v]; clearHistogram(db); createHistograms() end,
 							order = 3
 						},
 						xOfs = {
@@ -569,7 +569,7 @@ function mod:RebuildOpts()
 							type = "input",
 							pattern = "%d",
 							get = function() return tostring(db.point[4] or 0) end,
-							set = function(info, v) db.point[4] = tonumber(v); clearHistograms(); createHistograms() end,
+							set = function(info, v) db.point[4] = tonumber(v); clearHistogram(db); createHistograms() end,
 							order = 4
 						},
 						yOfs = {
@@ -577,7 +577,7 @@ function mod:RebuildOpts()
 							type = "input",
 							pattern = "%d",
 							get = function() return tostring(db.point[5] or 0) end,
-							set = function(info, v) db.point[5] = tonumber(v); clearHistograms();createHistograms() end,
+							set = function(info, v) db.point[5] = tonumber(v); clearHistogram(db);createHistograms() end,
 							order = 4
 						}
 					},
@@ -593,7 +593,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.expression = v;
 						db["expressionDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 8
@@ -608,7 +608,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.min = v;
 						db["minDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 10
@@ -624,7 +624,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.max = v;
 						db["maxDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 11
@@ -639,7 +639,7 @@ function mod:RebuildOpts()
 					set = function(info, v)
 						db.color = v;
 						db["colorDirty"] = true
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 12
@@ -650,7 +650,7 @@ function mod:RebuildOpts()
 					type = "execute",
 					func = function()
 						self.db.profile.histograms[k] = nil
-						clearHistograms()
+						clearHistogram(db)
 						createHistograms()
 					end,
 					order = 13
diff --git a/Modules/Text.lua b/Modules/Text.lua
index 1127623..beeac1b 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -2,6 +2,7 @@ local mod = StarTip:NewModule("Text", "AceTimer-3.0")
 mod.name = "Text"
 mod.toggled = true
 mod.childGroup = true
+mod.defaultOff = true
 local _G = _G
 local StarTip = _G.StarTip
 local GameTooltip = _G.GameTooltip