Mercurial > wow > reaction
changeset 95:168cae4aa8bd
Fixes:
- brute-force fix for invalid snippets
- copying profile data now results in immediate changes
- fixed keybinding tooltip display for pet bar simple actions
Also did a little condensing of the state driver rule string generation
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 21:39:07 +0000 |
parents | 39265b16d208 |
children | aa9074c92f11 |
files | ReAction.lua State.lua modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua modules/ReAction_PetAction/ReAction_PetAction.lua |
diffstat | 4 files changed, 49 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ReAction.lua Fri Oct 17 23:46:30 2008 +0000 +++ b/ReAction.lua Wed Oct 22 21:39:07 2008 +0000 @@ -245,7 +245,8 @@ -- initial profile is character-specific ) self.db.RegisterCallback(self,"OnProfileChanged") - self.db.RegisterCallback(self,"OnProfileReset","OnProfileChanged") + self.db.RegisterCallback(self,"OnProfileReset", "OnProfileChanged") + self.db.RegisterCallback(self,"OnProfileCopied","OnProfileChanged") KB.RegisterCallback(self,"LIBKEYBOUND_ENABLED") KB.RegisterCallback(self,"LIBKEYBOUND_DISABLED")
--- a/State.lua Fri Oct 17 23:46:30 2008 +0000 +++ b/State.lua Wed Oct 22 21:39:07 2008 +0000 @@ -195,7 +195,12 @@ function RefreshState( bar ) SetDefaultAnchor(bar) - bar:GetFrame():Execute([[control:RunAttribute("reaction-refresh")]]) + bar:GetFrame():Execute( + [[ + if self:GetAttribute("reaction-refresh") then + control:RunAttribute("reaction-refresh") + end + ]]) end function SetStateDriver( bar, rule ) @@ -320,24 +325,15 @@ -- strip out all spaces from the custom rule table.insert(rules, format("%s %s", c.custom:gsub("%s",""), state)) end - elseif type == "any" then - if c.values then - local clauses = { } - for key, value in pairs(c.values) do - table.insert(clauses, format("[%s]", ruleformats[key])) - end - if #clauses > 0 then - table.insert(rules, format("%s %s", table.concat(clauses), state)) - end - end - elseif type == "all" then + elseif type == "any" or type == "all" then if c.values then local clauses = { } for key, value in pairs(c.values) do table.insert(clauses, ruleformats[key]) end if #clauses > 0 then - table.insert(rules, format("%s %s", format("[%s]", table.concat(clauses, ",")), state)) + local sep = (type == "any") and "][" or "," + table.insert(rules, format("[%s] %s", table.concat(clauses,sep), state)) end end end
--- a/modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua Fri Oct 17 23:46:30 2008 +0000 +++ b/modules/ReAction_HideBlizzard/ReAction_HideBlizzard.lua Wed Oct 22 21:39:07 2008 +0000 @@ -27,7 +27,8 @@ } ) self.db.RegisterCallback(self,"OnProfileChanged") - self.db.RegisterCallback(self,"OnProfileReset","OnProfileChanged") + self.db.RegisterCallback(self,"OnProfileCopied", "OnProfileChanged") + self.db.RegisterCallback(self,"OnProfileReset", "OnProfileChanged") self.hiddenFrame = CreateFrame("Frame") self.hiddenFrame:Hide()
--- a/modules/ReAction_PetAction/ReAction_PetAction.lua Fri Oct 17 23:46:30 2008 +0000 +++ b/modules/ReAction_PetAction/ReAction_PetAction.lua Wed Oct 22 21:39:07 2008 +0000 @@ -11,6 +11,7 @@ local L = ReAction.L local _G = _G local CreateFrame = CreateFrame +local format = string.format ReAction:UpdateRevision("$Revision$") @@ -225,7 +226,7 @@ local frameRecycler = {} local trash = CreateFrame("Frame") -local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings +local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings, OnEnter, OnLeave do local buttonLookup = setmetatable({},{__mode="kv"}) @@ -304,6 +305,38 @@ button.border:Show() end end + + function OnEnter( self ) + if not self.tooltipName then + return; + end + local uber = GetCVar("UberTooltips") + if self.isToken or (uber == "0") then + if uber == "0" then + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + else + GameTooltip_SetDefaultAnchor(GameTooltip, self) + end + local tooltip = self.tooltipName + local k = GetBindings(self) + if k then + tooltip = tooltip .. format(" %s(%s)%s", NORMAL_FONT_COLOR_CODE, k, FONT_COLOR_CODE_CLOSE) + end + GameTooltip:SetText(tooltip) + if self.tooltipSubtext then + GameTooltip:AddLine(self.tooltipSubtext, "", 0.5, 0.5, 0.5) + end + GameTooltip:Show() + else + GameTooltip_SetDefaultAnchor(GameTooltip, self) + GameTooltip:SetPetAction(self:GetID()) + end + end + + function OnLeave() + GameTooltip:Hide() + end + end local meta = { __index = Button } @@ -345,6 +378,8 @@ f.hotkey = hotkey f:HookScript("OnDragStart", function() self:Update() end) f:HookScript("OnReceiveDrag", function() self:Update() end) + f:SetScript("OnEnter", OnEnter) + f:SetScript("OnLeave", OnLeave) end if config.actionID then f:SetID(config.actionID) -- PetActionButtonTemplate isn't a proper SecureActionButton