Mercurial > wow > reaction
comparison modules/ReAction_PetAction/ReAction_PetAction.lua @ 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 | ad49739d110d |
comparison
equal
deleted
inserted
replaced
94:39265b16d208 | 95:168cae4aa8bd |
---|---|
9 -- local imports | 9 -- local imports |
10 local ReAction = ReAction | 10 local ReAction = ReAction |
11 local L = ReAction.L | 11 local L = ReAction.L |
12 local _G = _G | 12 local _G = _G |
13 local CreateFrame = CreateFrame | 13 local CreateFrame = CreateFrame |
14 local format = string.format | |
14 | 15 |
15 ReAction:UpdateRevision("$Revision$") | 16 ReAction:UpdateRevision("$Revision$") |
16 | 17 |
17 -- libraries | 18 -- libraries |
18 local KB = LibStub("LibKeyBound-1.0") | 19 local KB = LibStub("LibKeyBound-1.0") |
223 end | 224 end |
224 }) | 225 }) |
225 | 226 |
226 local frameRecycler = {} | 227 local frameRecycler = {} |
227 local trash = CreateFrame("Frame") | 228 local trash = CreateFrame("Frame") |
228 local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings | 229 local KBAttach, GetActionName, GetHotkey, SetKey, FreeKey, ClearBindings, GetBindings, OnEnter, OnLeave |
229 do | 230 do |
230 local buttonLookup = setmetatable({},{__mode="kv"}) | 231 local buttonLookup = setmetatable({},{__mode="kv"}) |
231 | 232 |
232 -- Use KeyBound-1.0 for binding, but use Override bindings instead of | 233 -- Use KeyBound-1.0 for binding, but use Override bindings instead of |
233 -- regular bindings to support multiple profile use. This is a little | 234 -- regular bindings to support multiple profile use. This is a little |
302 if ReAction:GetKeybindMode() then | 303 if ReAction:GetKeybindMode() then |
303 button.border:SetVertexColor(KB:GetColorKeyBoundMode()) | 304 button.border:SetVertexColor(KB:GetColorKeyBoundMode()) |
304 button.border:Show() | 305 button.border:Show() |
305 end | 306 end |
306 end | 307 end |
308 | |
309 function OnEnter( self ) | |
310 if not self.tooltipName then | |
311 return; | |
312 end | |
313 local uber = GetCVar("UberTooltips") | |
314 if self.isToken or (uber == "0") then | |
315 if uber == "0" then | |
316 GameTooltip:SetOwner(self, "ANCHOR_RIGHT") | |
317 else | |
318 GameTooltip_SetDefaultAnchor(GameTooltip, self) | |
319 end | |
320 local tooltip = self.tooltipName | |
321 local k = GetBindings(self) | |
322 if k then | |
323 tooltip = tooltip .. format(" %s(%s)%s", NORMAL_FONT_COLOR_CODE, k, FONT_COLOR_CODE_CLOSE) | |
324 end | |
325 GameTooltip:SetText(tooltip) | |
326 if self.tooltipSubtext then | |
327 GameTooltip:AddLine(self.tooltipSubtext, "", 0.5, 0.5, 0.5) | |
328 end | |
329 GameTooltip:Show() | |
330 else | |
331 GameTooltip_SetDefaultAnchor(GameTooltip, self) | |
332 GameTooltip:SetPetAction(self:GetID()) | |
333 end | |
334 end | |
335 | |
336 function OnLeave() | |
337 GameTooltip:Hide() | |
338 end | |
339 | |
307 end | 340 end |
308 | 341 |
309 local meta = { __index = Button } | 342 local meta = { __index = Button } |
310 | 343 |
311 function Button:New( bar, idx, config ) | 344 function Button:New( bar, idx, config ) |
343 hotkey:SetJustifyV("TOP") | 376 hotkey:SetJustifyV("TOP") |
344 hotkey:SetPoint("TOPLEFT",f,"TOPLEFT",-2,-2) | 377 hotkey:SetPoint("TOPLEFT",f,"TOPLEFT",-2,-2) |
345 f.hotkey = hotkey | 378 f.hotkey = hotkey |
346 f:HookScript("OnDragStart", function() self:Update() end) | 379 f:HookScript("OnDragStart", function() self:Update() end) |
347 f:HookScript("OnReceiveDrag", function() self:Update() end) | 380 f:HookScript("OnReceiveDrag", function() self:Update() end) |
381 f:SetScript("OnEnter", OnEnter) | |
382 f:SetScript("OnLeave", OnLeave) | |
348 end | 383 end |
349 if config.actionID then | 384 if config.actionID then |
350 f:SetID(config.actionID) -- PetActionButtonTemplate isn't a proper SecureActionButton | 385 f:SetID(config.actionID) -- PetActionButtonTemplate isn't a proper SecureActionButton |
351 end | 386 end |
352 f:SetFrameStrata("MEDIUM") | 387 f:SetFrameStrata("MEDIUM") |