From 07278c2f8bf1d370eba510507cd5176acc55f2b7 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Sun, 3 Jul 2011 22:42:34 +0000 Subject: [PATCH] Bug fix. Update Histogram module with LibQTip migration. --- Modules/Histograms/Histograms.lua | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Modules/Histograms/Histograms.lua b/Modules/Histograms/Histograms.lua index 03bad19..e9e43e0 100644 --- a/Modules/Histograms/Histograms.lua +++ b/Modules/Histograms/Histograms.lua @@ -54,12 +54,13 @@ local defaultWidgets = { enabled = true, width = 10, height = 50, - points = {{"TOPLEFT", "GameTooltip", "BOTTOMLEFT", 0, -12}}, + points = {{"TOPLEFT", "StarTipQTipMain", "BOTTOMLEFT", 0, -12}}, color = [[ return HPColor(UnitHealth(unit), UnitHealthMax(unit)) ]], layer = 1, - update = 1000 + update = 1000, + parent = "StarTipQTipMain" }, [2] = { name = "Power", @@ -69,12 +70,13 @@ return HPColor(UnitHealth(unit), UnitHealthMax(unit)) enabled = true, width = 10, height = 50, - points = {{"TOPRIGHT", "GameTooltip", "BOTTOMRIGHT", -100, -12}}, + points = {{"TOPRIGHT", "StarTipQTipMain", "BOTTOMRIGHT", -100, -12}}, color = [[ return PowerColor("RAGE", unit) ]], layer = 1, - update = 1000 + update = 1000, + parent = "StarTipQTipMain" }, [3] = { name = "Mem", @@ -103,12 +105,13 @@ end char = "0", width = 10, height = 50, - points = {{"TOPLEFT", "GameTooltip", "BOTTOMLEFT", 0, -77}}, + points = {{"TOPLEFT", "StarTipQTipMain", "BOTTOMLEFT", 0, -77}}, layer = 1, update = 1000, persistent = true, intersect = true, intersectPad = 1000, + parent = "StarTipQTipMain" }, [4] = { name = "CPU", @@ -137,7 +140,7 @@ end char = "0", width = 10, height = 50, - points = {{"TOPRIGHT", "GameTooltip", "BOTTOMRIGHT", -100, -77}}, + points = {{"TOPRIGHT", "StarTipQTipMain", "BOTTOMRIGHT", -100, -77}}, layer = 1, update = 1000, persistent = true, @@ -170,7 +173,7 @@ local optionsDefaults = { height = WidgetHistogram.defaults.height, width = WidgetHistogram.defaults.width, enabled = true, - points = {{"TOPLEFT", "GameTooltip", "BOTTOMLEFT", 0, -50}}, + points = {{"TOPLEFT", "StarTipQTipMain", "BOTTOMLEFT", 0, -50}}, texture = LSM:GetDefault("statusbar"), expression = "return random(100)", color = "return 0, 0, 1", @@ -222,13 +225,19 @@ local textureDict = {} local new, del do local pool = {} - function new() + function new(parent) + if type(parent) == "string" then + parent = _G[parent] + end + if type(parent) ~= "table" then + parent = _G["StarTipQTipMain"] + end local histogram = next(pool) if histogram then pool[histogram] = nil else - histogram = CreateFrame("StatusBar", nil, GameTooltip) + histogram = CreateFrame("StatusBar", nil, parent) end return histogram @@ -276,7 +285,7 @@ local function createHistograms() end end - for k, v in pairs(self.db.profile.histograms) do + for k, v in pairs(mod.db.profile.histograms) do if v.enabled and not v.deleted then v.width = v.width or WidgetHistogram.defaults.width local widget = mod.histograms[v] @@ -307,8 +316,8 @@ local function createHistograms() bar:SetWidth(v.width or 6) end else - bar:SetPoint("TOPLEFT", GameTooltip, "TOPLEFT") - bar:SetPoint("BOTTOMLEFT", GameTooltip, "BOTTOMLEFT") + bar:SetPoint("TOPLEFT", v.parent or _G["StarTipQTipMain"], "TOPLEFT") + bar:SetPoint("BOTTOMLEFT", v.parent or _G["StarTipQTipMain"], "BOTTOMLEFT") end bar:SetHeight(v.height) bar:SetMinMaxValues(0, 100) @@ -603,4 +612,4 @@ function mod:UpdateMana() local color = power[UnitPowerType(unit)] self.mpHistogram:SetStatusBarColor(color.r, color.g, color.b) end -]] \ No newline at end of file +]] -- 1.7.9.5