From 6fcc8737938ea763f6bae88193537fdd954cb933 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Wed, 1 Dec 2010 20:19:10 +0000 Subject: [PATCH] Give bars an orientation option. Add a vertical threat bar. --- Modules/Bars/Bars.lua | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Modules/Bars/Bars.lua b/Modules/Bars/Bars.lua index 09c72d9..1fd02c6 100644 --- a/Modules/Bars/Bars.lua +++ b/Modules/Bars/Bars.lua @@ -68,6 +68,7 @@ else end ]], height = 6, + width = 6, points = {{"BOTTOM", "GameTooltip", "TOP", 0, 0}, {"LEFT", "GameTooltip", "LEFT", 5, 0}, {"RIGHT", "GameTooltip", "RIGHT", -5, 0}}, texture1 = LSM:GetDefault("statusbar"), enabled = true, @@ -87,13 +88,35 @@ return UnitMana(unit) return PowerColor(nil, unit) ]], height = 6, + width = 6, points = {{"TOP", "GameTooltip", "BOTTOM", 0, 0}, {"LEFT", "GameTooltip", "LEFT", 5, 0}, {"RIGHT", "GameTooltip", "RIGHT", -5, 0}}, texture1 = LSM:GetDefault("statusbar"), enabled = true, layer = 1, level = 100 }, - + [3] = { + name = "Threat Bar", + type = "bar", + expression = [[ +local _,_,threatpct = UnitDetailedThreatSituation(unit, "target") +return threatpct or 0 +]], + color1 = [[ +local _, status = UnitDetailedThreatSituation(unit, "target") +return GetThreatStatusColor(status) +]], + width = 6, + height = 0, + points = {{"LEFT", "GameTooltip", "RIGHT", 0, 0}, {"TOP", "GameTooltip", "TOP", 0, -5}, {"BOTTOM", "GameTooltip", "BOTTOM", 0, 5}}, + texture = LSM:GetDefault("statusbar"), + min = "return 0", + max = "return 100", + enabled = true, + layer = 1, + level = 100, + orientation = WidgetBar.ORIENTATION_VERTICAL + } } @@ -228,9 +251,14 @@ local function createBars() local widget = mod.bars[v] if not widget then local bar = new() - widget = WidgetBar:New(mod.core, v.name, v, v.row or 0, v.col or 0, v.layer or 0, StarTip.db.profile.errorLevel, updateBar, bar) + widget = WidgetBar:New(mod.core, v.name, copy(v), v.row or 0, v.col or 0, v.layer or 0, StarTip.db.profile.errorLevel, updateBar, bar) bar:SetStatusBarTexture(LSM:Fetch("statusbar", v.texture1)) bar:ClearAllPoints() + if widget.orientation == WidgetBar.ORIENTATION_VERTICAL then + bar:SetOrientation("VERTICAL") + else + bar:SetOrientation("HORIZONTAL") + end for j, point in ipairs(v.points) do local arg1, arg2, arg3, arg4, arg5 = unpack(point) arg4 = (arg4 or 0) -- 1.7.9.5