diff --git a/Modules/Bars.lua b/Modules/Bars.lua index d970adb..939e4e0 100644 --- a/Modules/Bars.lua +++ b/Modules/Bars.lua @@ -328,10 +328,20 @@ function mod:OnInitialize() end function mod:OnEnable() - self:ClearBars() GameTooltip:SetClampRectInsets(0, 0, 10, 10) StarTip:SetOptionsDisabled(options, false) intersectTimer = intersectTimer or LibTimer:New("Texts.intersectTimer", 100, true, intersectUpdate) + self:ClearBars() + for k, bar in pairs(self.bars) do + if bar.config.alwaysShown then + bar:Start() + bar.bar:Show() + if bar.secondBar then + bar.secondBar:Start() + bar.secondBar:Show() + end + end + end end function mod:OnDisable() @@ -368,11 +378,13 @@ end function mod:SetItem() for i, bar in pairs(self.bars) do - bar:Stop() - bar.bar:Hide() - if bar.secondBar then - bar.secondBar:Stop() - bar.secondBar.bar:Hide() + if not bar.config.alwaysShown then + bar:Stop() + bar.bar:Hide() + if bar.secondBar then + bar.secondBar:Stop() + bar.secondBar.bar:Hide() + end end end intersectTimer:Start() @@ -380,11 +392,13 @@ end function mod:SetSpell() for i, bar in pairs(self.bars) do - bar:Stop() - bar.bar:Hide() - if bar.secondBar then - bar.secondBar:Stop() - bar.secondBar.bar:Hide() + if not bar.config.alwaysShown then + bar:Stop() + bar.bar:Hide() + if bar.secondBar then + bar.secondBar:Stop() + bar.secondBar.bar:Hide() + end end end intersectTimer:Start() @@ -396,11 +410,13 @@ function mod:OnHide() timer = nil end for i, bar in pairs(self.bars) do - bar:Stop() - bar.bar:Hide() - if bar.secondBar then - bar.secondBar:Stop() - bar.secondBar.bar:Hide() + if not bar.config.alwaysShown then + bar:Stop() + bar.bar:Hide() + if bar.secondBar then + bar.secondBar:Stop() + bar.secondBar.bar:Hide() + end end end intersectTimer:Stop() diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua index 779877c..9333dd6 100644 --- a/Modules/Histograms.lua +++ b/Modules/Histograms.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 WidgetHistogram = LibStub("StarLibWidgetHistogram-1.0") local LibCore = LibStub("StarLibCore-1.0") @@ -221,7 +220,7 @@ function updateHistogram(widget) bar:SetValue(0) --segment * 100) bar:SetStatusBarColor(0, 0, 1, 1) end - if not UnitExists(StarTip.unit) then bar:Hide() end + if not UnitExists(StarTip.unit) and not widget.config.alwaysShown then bar:Hide() end end end @@ -384,13 +383,21 @@ function mod:OnInitialize() self.histograms = {} end -function mod:OnEnable() - self:ClearHistograms() - createHistograms() +function mod:OnEnable() 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() + for k, histogram in pairs(self.histograms) do + if histogram.config.alwaysShown then + histogram:Start() + for _, bar in pairs(histogram.bars) do + bar:Show() + end + end + end end function mod:OnDisable() @@ -424,11 +431,13 @@ end function mod:SetItem() for k, widget in pairs(self.histograms) do - for i = 1, widget.width or WidgetHistogram.defaults.width do - widget.bars[i]:Hide() - end - if not widget.persistent then - widget:Stop() + if not widget.config.alwaysShown then + for i, bar in pairs(widget.bars) do + bar:Hide() + end + if not widget.persistent then + widget:Stop() + end end end if self.intersectTimer then @@ -438,11 +447,13 @@ end function mod:SetSpell() for k, widget in pairs(self.histograms) do - for i = 1, widget.width or WidgetHistogram.defaults.width do - widget.bars[i]:Hide() - end - if not widget.persistent then - widget:Stop() + if not widget.config.alwaysShown then + for i, bar in pairs(widget.bars) do + bar:Hide() + end + if not widget.persistent then + widget:Stop() + end end end if self.intersectTimer then @@ -451,16 +462,14 @@ function mod:SetSpell() end function mod:OnHide() - if timer then - self:CancelTimer(timer) - timer = nil - end for k, widget in pairs(self.histograms) do - for i = 1, widget.width or WidgetHistogram.defaults.width do - widget.bars[i]:Hide() - end - if not widget.persistent then - widget:Stop() + if not widget.config.alwaysShown then + for i, bar in pairs(widget.bars) do + bar:Hide() + end + if not widget.persistent then + widget:Stop() + end end end if self.intersectTimer then diff --git a/Modules/Text.lua b/Modules/Text.lua index 9f3372e..9bad1e3 100644 --- a/Modules/Text.lua +++ b/Modules/Text.lua @@ -311,7 +311,7 @@ function updateText(widget) widget.frame:SetBackdropColor(r, g, b, a) - if not UnitExists(StarTip.unit or "mouseover") then + if not UnitExists(StarTip.unit or "mouseover") and not widget.config.alwaysShown then widget.frame:Hide() end end @@ -349,7 +349,7 @@ do frame:SetAlpha(1) local fs = frame:CreateFontString() fs:SetAllPoints(frame) - fs:SetFontObject(GameTooltipText) + fs:SetFontObject(GameFontNormal) fs:Show() frame.fontstring = fs text = frame @@ -377,6 +377,7 @@ local function clearText(obj) if not widget then return end widget:Del() widget.frame:Hide() + widget.frame.fontstring:Hide() del(widget.frame) end @@ -398,13 +399,16 @@ function createTexts() local appearance = StarTip:GetModule("Appearance") for i, v in ipairs(self.db.profile.texts) do - if v.enabled and not v.deleted then + if v.enabled and not v.deleted then + if v.alwaysShown then + StarTip:Print("always shown bogeyman") + end local widget = mod.texts[v] if not widget then local text = new(v.background) widget = WidgetText:New(mod.core, v.name, v, v.row or 0, v.col or 0, v.layer or 0, StarTip.db.profile.errorLevel, updateText) text:ClearAllPoints() - text:SetParent(v.parent) + text:SetParent("UIParent") for j, point in ipairs(v.points) do local arg1, arg2, arg3, arg4, arg5 = unpack(point) arg4 = (arg4 or 0) @@ -417,7 +421,6 @@ function createTexts() widget.frame = text widget.frame = text mod.texts[v] = widget - widget.shownAlways = v.shownAlways end widget.config.unit = StarTip.unit end @@ -466,10 +469,17 @@ end function mod:OnEnable() self:ClearTexts() - createTexts() intersectTimer = intersectTimer or LibTimer:New("Texts.intersectTimer", 100, true, intersectUpdate) GameTooltip:SetClampRectInsets(0, 0, 10, 10) StarTip:SetOptionsDisabled(options, false) + createTexts() + for k, text in pairs(self.texts) do + if text.config.alwaysShown then + StarTip:Print("always shown -------------------------") + text:Start() + text.frame:Show() + end + end end function mod:OnDisable() @@ -503,7 +513,7 @@ end function mod:SetItem() for i, text in pairs(self.texts) do - if not text.shownAlways then + if not text.config.alwaysShown then text:Stop() text.frame:Hide() end @@ -513,7 +523,7 @@ end function mod:SetSpell() for i, text in pairs(self.texts) do - if not text.shownAlways then + if not text.config.alwaysShown then text:Stop() text.frame:Hide() end @@ -527,7 +537,7 @@ function mod:OnHide() timer = nil end for i, text in pairs(self.texts) do - if not text.shownAlways then + if not text.config.alwaysShown then text:Stop() text.frame:Hide() end diff --git a/StarTip.lua b/StarTip.lua index 865fd99..1000be3 100644 --- a/StarTip.lua +++ b/StarTip.lua @@ -130,7 +130,7 @@ StarTip.opposites = { } local SINGLETON_CLASSIFICATIONS = { - "player", --This causes the tooltip to stay shown after you mouse over your own unit frame. + "player", "pet", "pettarget", "target", @@ -622,7 +622,6 @@ end local hideTimer local function hideTooltip() - do return end local mod = StarTip:GetModule("UnitTooltip") if GameTooltip:GetAlpha() < 1 then GameTooltip:Hide(); StarTip.unit = false; return end if GameTooltip:NumLines() > mod.NUM_LINES then GameTooltip:Hide(); StarTip.unit = false; return end diff --git a/modules.xml b/modules.xml index 992d8d4..1244b92 100644 --- a/modules.xml +++ b/modules.xml @@ -12,6 +12,7 @@ <Script file = "Modules\Bars.lua"/> <Script file = "Modules\Histograms.lua"/> <Script file = "Modules\UnitTooltip.lua"/> + <!--<Script file = "Modules\Debug.lua"/> -->