From 213aa2340f43a8b01c80bb536322942e702ec84c Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Tue, 5 Jul 2011 22:29:33 +0000 Subject: [PATCH] Bug fixes and stop making LibCores everywhere. Only one's needed. --- Modules/Border/Border.lua | 4 +--- Modules/Histograms/Histograms.lua | 9 +++------ Modules/Portrait/Portrait.lua | 8 ++++++-- Modules/Texts/Texts.lua | 9 +-------- Modules/UnitTooltip/UnitTooltip.lua | 11 ++++------- StarTip.lua | 11 ++++++++--- 6 files changed, 23 insertions(+), 29 deletions(-) diff --git a/Modules/Border/Border.lua b/Modules/Border/Border.lua index 2c6f830..e7173fb 100644 --- a/Modules/Border/Border.lua +++ b/Modules/Border/Border.lua @@ -4,7 +4,6 @@ mod.toggled = true mod.defaultOff = false local L = StarTip.L local WidgetColor = LibStub("LibScriptableWidgetColor-1.0") -local LibCore = LibStub("LibScriptableLCDCore-1.0") local _G = _G local StarTip = _G.StarTip local UIParent = _G.UIParent @@ -80,7 +79,7 @@ end function mod:CreateBorders() for i, border in ipairs(self.db.profile.borders) do - local widget = WidgetColor:New(self.core, border.name, copy(border), StarTip.db.profile.errorLevel, draw) + local widget = WidgetColor:New(StarTip.core, border.name, copy(border), StarTip.db.profile.errorLevel, draw) tinsert(borders, widget) end end @@ -95,7 +94,6 @@ end function mod:OnInitialize() self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults) StarTip:SetOptionsDisabled(options, true) - self.core = LibCore:New(mod, environment, "StarTip.Border", {["StarTip.Border"] = {}}, nil, StarTip.db.profile.errorLevel) end function mod:OnEnable() diff --git a/Modules/Histograms/Histograms.lua b/Modules/Histograms/Histograms.lua index e9e43e0..1a4b83c 100644 --- a/Modules/Histograms/Histograms.lua +++ b/Modules/Histograms/Histograms.lua @@ -292,7 +292,7 @@ local function createHistograms() local newWidget if not mod.histograms then mod.histograms = {} end if not widget then - widget = WidgetHistogram:New(mod.core, v.name, v, v.row or 0, v.col or 0, 0, StarTip.db.profile.errorLevel, updateHistogram) + widget = WidgetHistogram:New(StarTip.core, v.name, v, v.row or 0, v.col or 0, 0, StarTip.db.profile.errorLevel, updateHistogram) widget.persistent = v.persistent newWidget = true for i = 0, v.width - 1 do @@ -379,14 +379,12 @@ function mod:OnInitialize() end function mod:OnEnable() - self.core = StarTip.core --LibCore:New(mod, environment, "StarTip.Histograms", {["StarTip.Histograms"] = {}}, nil, StarTip.db.profile.errorLevel) - StarTip:SetOptionsDisabled(options, false) if StarTip.db.profile.intersectRate > 0 then self.intersectTimer = self.intersectTimer or LibTimer:New("Texts.intersectTimer", self.db.profile.intersectRate or 200, true, intersectUpdate) end self:ClearHistograms() - createHistograms() + self:CreateHistograms() for k, histogram in pairs(self.histograms) do if histogram.config.alwaysShown then histogram:Start() @@ -398,7 +396,6 @@ function mod:OnEnable() end function mod:OnDisable() - self.core:Del() self:ClearHistograms() StarTip:SetOptionsDisabled(options, true) if self.intersectTimer then self.intersectTimer:Stop() end @@ -413,7 +410,6 @@ function mod:SetUnit() GameTooltipStatusBar:Hide() self.offset = 0 - createHistograms() for k, widget in pairs(self.histograms) do for i = 1, widget.width or WidgetHistogram.defaults.width do widget.bars[i]:Show() @@ -485,6 +481,7 @@ end function mod:RebuildOpts() local defaults = WidgetHistogram.defaults self:ClearHistograms() + self:CreateHistograms() wipe(options) for k, v in pairs(optionsDefaults) do options[k] = v diff --git a/Modules/Portrait/Portrait.lua b/Modules/Portrait/Portrait.lua index f58bcbb..540da04 100644 --- a/Modules/Portrait/Portrait.lua +++ b/Modules/Portrait/Portrait.lua @@ -206,6 +206,10 @@ function mod:SetSpell() end function mod:OnHide() - self.model:Hide() - self.texture:Hide() + if self.model then + self.model:Hide() + self.model2:Hide() + self.texture:Hide() + self.texture2:Hide() + end end diff --git a/Modules/Texts/Texts.lua b/Modules/Texts/Texts.lua index 9257a28..a67c8e4 100644 --- a/Modules/Texts/Texts.lua +++ b/Modules/Texts/Texts.lua @@ -12,7 +12,6 @@ local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS local UnitSelectionColor = _G.UnitSelectionColor local UnitClass = _G.UnitClass local self = mod -local timer local LSM = LibStub("LibSharedMedia-3.0") local WidgetText = LibStub("LibScriptableWidgetText-1.0") local LibCore = LibStub("LibScriptableLCDCore-1.0") @@ -411,7 +410,7 @@ function createTexts() local widget = mod.texts[v] if not widget then local text = new(v.background, v.frameName, v.parent) - widget = WidgetText:New(mod.core, v.name, copy(v), v.row or 0 or 0, v.col or 0, v.layer or 0, StarTip.db.profile.errorLevel, updateText) + widget = WidgetText:New(StarTip.core, v.name, copy(v), v.row or 0 or 0, v.col or 0, v.layer or 0, StarTip.db.profile.errorLevel, updateText) text:ClearAllPoints() for j, point in ipairs(v.points) do local arg1, arg2, arg3, arg4, arg5 = unpack(point) @@ -462,8 +461,6 @@ function mod:OnInitialize() self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults) self:ReInit() - - self.core = StarTip.core --LibCore:New(mod, environment, "StarTip.Texts", {["StarTip.Texts"] = {}}, nil, StarTip.db.profile.errorLevel) StarTip:SetOptionsDisabled(options, true) @@ -534,10 +531,6 @@ function mod:SetSpell() end function mod:OnHide() - if timer then - self:CancelTimer(timer) - timer = nil - end for i, text in pairs(self.texts) do if not text.config.alwaysShown then text:Stop() diff --git a/Modules/UnitTooltip/UnitTooltip.lua b/Modules/UnitTooltip/UnitTooltip.lua index bbf0baf..9bc6916 100644 --- a/Modules/UnitTooltip/UnitTooltip.lua +++ b/Modules/UnitTooltip/UnitTooltip.lua @@ -943,27 +943,25 @@ function mod:CreateLines() end local left, right = '', '' environment.unit = StarTip.unit -print("hmmmmm", StarTip.core.environment.unit) if v.right and v.right ~= "" then if v.rightObj then environment.self = v.rightObj - --right = mod.evaluator.ExecuteCode(environment, v.name .. " right", v.right) + right = mod.evaluator.ExecuteCode(environment, v.name .. " right", v.right) if type(right) == "number" then right = right .. "" end end if v.leftObj then environment.self = v.leftObj - --left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) + left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) if type(left) == "number" then left = left .. "" end end else if v.leftObj then environment.self = v.leftObj - --left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) + left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) if type(left) == "number" then left = left .. "" end end right = '' end -print("rawr", StarTip.core.environment.unit) if type(left) == "string" and type(right) == "string" then lineNum = lineNum + 1 @@ -1529,9 +1527,8 @@ function mod:SetUnit() StarTip:TrunkAdd(txt1, r1, g1, b1, txt2, r2, g2, b2) end lines() - --self.timer:Start() draw() -print(UnitName(StarTip.unit)) + self.timer:Start() end --[[ function mod:RefixEndLines() diff --git a/StarTip.lua b/StarTip.lua index 1821ea2..e5e0533 100644 --- a/StarTip.lua +++ b/StarTip.lua @@ -731,6 +731,8 @@ function StarTip.OnTooltipSetUnit(...) if not unit or StarTip.tooltipHidden then GameTooltip:Hide() return end + environment.unit = unit + StarTip:TrunkClear() trunkLines = GameTooltip:NumLines() @@ -757,7 +759,9 @@ function StarTip.OnTooltipSetUnit(...) if v.SetUnit and v:IsEnabled() then v:SetUnit() end end end - StarTip.justSetUnit = nil + + StarTip.justSetUnit = false + --checkTooltipAlphaFrame:SetScript("OnUpdate", checkTooltipAlpha) StarTip.tooltipMain:Show() StarTip.trunkTimer:Start() @@ -908,13 +912,14 @@ end function StarTip:GameTooltipFadeOut(...) local fadeOut = true for k, v in StarTip:IterateModules() do - if v.GameTooltipFadeOut and v:IsEnabled() then - fadeOut = fadeOut and v:GameTooltipFadeOut(...) + if v.OnFadeOut and v:IsEnabled() then + fadeOut = fadeOut and v:OnFadeOut(...) end end if fadeOut then StarTip.hooks[GameTooltip].FadeOut(...) end + self.tooltipMain:Hide() end function StarTip:GetLSMIndexByName(category, name) -- 1.7.9.5