From 20e81133067e5dffa25d2b80bf89428bdd313908 Mon Sep 17 00:00:00 2001 From: Parnic Date: Fri, 26 Sep 2008 18:08:56 +0000 Subject: [PATCH] - added horizontal positioning option to the ToT module by request - added an option to disable click-targeting while in combat by request --- modules/PlayerHealth.lua | 36 +++++++++++++++++++++++++++++++++++- modules/TargetOfTarget.lua | 23 ++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index a3b7b8a..eceba09 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -23,6 +23,7 @@ function PlayerHealth.prototype:GetDefaultSettings() settings["upperText"] = "[PercentHP:Round]" settings["lowerText"] = "[FractionalHP:HPColor:Bracket]" settings["allowMouseInteraction"] = true + settings["allowMouseInteractionCombat"] = false settings["lockIconAlpha"] = false settings["showStatusIcon"] = true @@ -153,6 +154,24 @@ function PlayerHealth.prototype:GetOptions() order = 43 } + opts["allowClickTargetCombat"] = { + type = 'toggle', + name = 'Allow click-targeting in combat', + desc = 'Whether or not to allow click targeting/casting and the player drop-down menu for this bar while the player is in combat (Note: does not work properly with HiBar, have to click near the base of the bar)', + get = function() + return self.moduleSettings.allowMouseInteractionCombat + end, + set = function(v) + self.moduleSettings.allowMouseInteractionCombat = v + self:CreateBackground(true) + end, + disabled = function() + return not self.moduleSettings.enabled or not self.moduleSettings.allowMouseInteraction + end, + usage = '', + order = 43.5 + } + opts["iconSettings"] = { type = 'group', @@ -515,7 +534,12 @@ function PlayerHealth.prototype:CreateBackground(redraw) ToggleDropDownMenu(1, nil, PlayerFrameDropDown, "cursor"); end - if self.moduleSettings.allowMouseInteraction then + self:EnableClickTargeting(self.moduleSettings.allowMouseInteraction) +end + + +function PlayerHealth.prototype:EnableClickTargeting(bEnable) + if bEnable then self.frame.button:EnableMouse(true) self.frame.button:RegisterForClicks("AnyUp") self.frame.button:SetAttribute("type1", "target") @@ -573,6 +597,16 @@ end function PlayerHealth.prototype:CheckCombat() PlayerHealth.super.prototype.CheckCombat(self) + if self.combat then + if self.moduleSettings.allowMouseInteraction and not self.moduleSettings.allowMouseInteractionCombat then + self:EnableClickTargeting(false) + end + else + if self.moduleSettings.allowMouseInteraction and not self.moduleSettings.allowMouseInteractionCombat then + self:EnableClickTargeting(true) + end + end + if self.combat or configMode then if (configMode or self.moduleSettings.showStatusIcon) and not self.frame.statusIcon then self.frame.statusIcon = self:CreateTexCoord(self.frame.statusIcon, "Interface\\CharacterFrame\\UI-StateIcon", 20, 20, diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 3df20e1..8ce5cce 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -48,6 +48,26 @@ function TargetOfTarget.prototype:GetOptions() order = 31 } + opts["hpos"] = { + type = "range", + name = "Horizontal Position", + desc = "Horizontal Position", + get = function() + return self.moduleSettings.hpos + end, + set = function(v) + self.moduleSettings.hpos = v + self:Redraw() + end, + min = -500, + max = 500, + step = 10, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 31.5 + } + opts["showDebuffs"] = { type = "toggle", name = "Show stacking debuffs", @@ -166,6 +186,7 @@ end function TargetOfTarget.prototype:GetDefaultSettings() local defaults = TargetOfTarget.super.prototype.GetDefaultSettings(self) defaults["vpos"] = -130 + defaults["hpos"] = 0 defaults["showDebuffs"] = true defaults["fontSize"] = 15 defaults["mouse"] = true @@ -222,7 +243,7 @@ function TargetOfTarget.prototype:CreateFrame() self.frame:SetWidth(self.moduleSettings.totWidth) end self.frame:SetHeight(self.height) - self.frame:SetPoint("TOP", self.parent, "TOP", 0, self.moduleSettings.vpos) + self.frame:SetPoint("TOP", self.parent, "TOP", self.moduleSettings.hpos, self.moduleSettings.vpos) self.frame:SetScale(self.moduleSettings.scale)