WoWInterface SVN PhanxWatchFrame

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 11 to Rev 12
    Reverse comparison

Rev 11 → Rev 12

PhanxWatchFrame.lua File deleted \ No newline at end of file
Animations.lua New file
0,0 → 1,51
local MIN_ALPHA, MAX_ALPHA = 0.25, 1
 
local hasMouseFocus
local GetMouseFocus = GetMouseFocus
 
local fades = WatchFrame:CreateAnimationGroup()
 
local fadeIn = fades:CreateAnimation("Alpha")
fadeIn:SetChange(MAX_ALPHA - MIN_ALPHA)
fadeIn:SetDuration(0.25)
fadeIn:SetStartDelay(0)
WatchFrame.animateFadeIn = fadeIn
 
local fadeOut = fades:CreateAnimation("Alpha")
fadeOut:SetChange(MIN_ALPHA - MAX_ALPHA)
fadeOut:SetDuration(0.5)
fadeOut:SetStartDelay(0.5)
WatchFrame.animateFadeOut = fadeOut
 
local descendants = setmetatable({}, { __index = function(t, f)
local parent = f:GetParent()
while parent do
if parent == WatchFrame then
t[f] = true
return true
end
parent = parent:GetParent()
end
t[f] = false
return false
end })
 
WatchFrame:HookScript("OnUpdate", function(self, elapsed)
local mouseFocus = GetMouseFocus()
local gotMouseFocus = mouseFocus == self or descendants[mouseFocus]
if gotMouseFocus == hasMouseFocus then
return
end
if gotMouseFocus then
print("WatchFrame gained mouse focus.")
fades:Stop()
self:SetAlpha(MIN_ALPHA)
fadeIn:Play()
else
print("WatchFrame lost mouse focus.")
fades:Stop()
self:SetAlpha(MAX_ALPHA)
fadeOut:Play()
end
hasMouseFocus = gotMouseFocus
end)
\ No newline at end of file
PhanxWatchFrame.toc
1,11 → 1,12
## Interface: 50200
## Version: 5.2.0.wowi:revision
 
## Notes: Moves the watch frame, makes it wider, and hides the header.
## Notes: Moves the watch frame, makes it wider, hides the header, fades in on mouseover.
 
## Author: Phanx
## X-Email: addons@phanx.net
## X-Copyright: Copyright (c) 2009-2013 Phanx. All rights reserved.
## X-License: See the accompanying LICENSE file for details.
 
PhanxWatchFrame.lua
\ No newline at end of file +Addon.lua +Animations.lua \ No newline at end of file
Addon.lua New file
0,0 → 1,154
--[[
PhanxWatchFrame
Copyright (c) 2009-2013 Phanx <addons@phanx.net>. All rights reserved.
See the accompanying LICENSE file for details.
--]]
 
hooksecurefunc("WatchFrameItem_UpdateCooldown", function(button)
if button and PhanxBorder and not button.BorderTextures then
button:SetSize(34, 34)
PhanxBorder.AddBorder(button)
_G[button:GetName() .. "IconTexture"]:SetTexCoord(0.06, 0.94, 0.06, 0.94)
_G[button:GetName() .. "NormalTexture"]:SetTexture("")
end
end)
 
hooksecurefunc("WatchFrame_SetWidth", function(width)
WATCHFRAME_EXPANDEDWIDTH = 406
WATCHFRAME_MAXLINEWIDTH = 394
if WatchFrame:IsShown() and not WatchFrame.collapsed then
WatchFrame:SetWidth(WATCHFRAME_EXPANDEDWIDTH)
WatchFrame_Update()
end
end)
 
hooksecurefunc("WatchFrame_SetLine", function(line, anchor, verticalOffset, isHeader, text, dash, hasItem, isComplete, eligible)
if isHeader then
line.text:SetTextColor(1, 0.8, 0)
elseif line.text.eligible then
line.text:SetTextColor(1, 1, 1)
end
end)
--[[
local wasMouseOver
WatchFrame:HookScript("OnUpdate", function(self)
local isMouseOver = self:IsMouseOver()
if isMouseOver == wasMouseOver then return end
self:SetAlpha(isMouseOver and 1 or 0.3)
wasMouseOver = isMouseOver
end)
]]
hooksecurefunc("WatchFrameLinkButtonTemplate_Highlight", function(self, onEnter)
if onEnter then
for i = self.startLine, self.lastLine do
local line = self.lines[i]
if line then
line.text:SetTextColor(1, 1, 0)
end
end
else
for i = self.startLine, self.lastLine do
local line = self.lines[i]
if line then
if i == self.startLine then
line.text:SetTextColor(1, 0.8, 0)
else
if line.text.eligible then
line.text:SetTextColor(1, 1, 1)
end
line.dash:SetTextColor(1, 1, 1)
end
end
end
end
end)
 
local origOnClick = WatchFrameLinkButtonTemplate_OnClick
WatchFrameLinkButtonTemplate_OnClick = function(self, button, pushed)
if button == "LeftButton" and not (IsAltKeyDown() or IsControlKeyDown() or IsShiftKeyDown()) then
CloseDropDownMenus()
if self.type == "QUEST" then
local questIndex = GetQuestIndexForWatch(self.index)
-- ExpandQuestHeader(GetQuestSortIndex(questIndex))
-- QuestLog_OpenToQuest(questIndex)
 
local selectedIndex = GetQuestLogSelection()
if selectedIndex ~= 0 and questIndex == selectedIndex and QuestLogFrame:IsShown() then
return HideUIPanel(QuestLogFrame)
end
 
local numEntries, numQuests = GetNumQuestLogEntries()
if questIndex < 1 or questIndex > numEntries then
return
end
 
ExpandQuestHeader(0)
ShowUIPanel(QuestLogFrame)
QuestLog_SetSelection(questIndex)
elseif self.type == "ACHIEVEMENT" then
if not AchievementFrame then
AchievementFrame_LoadUI()
end
if not AchievementFrame:IsShown() then
AchievementFrame_ToggleAchievementFrame()
AchievementFrame_SelectAchievement(self.index)
else
if AchievementFrameAchievements.selection ~= self.index then
AchievementFrame_SelectAchievement(self.index)
else
AchievementFrame_ToggleAchievementFrame()
end
end
end
return
end
return origOnClick(self, button, pushed)
end
 
WATCHFRAME_TYPE_OFFSET = 0
WATCHFRAME_QUEST_OFFSET = 0
WATCHFRAME_MULTIPLE_LINEHEIGHT = 20
 
local PWF = CreateFrame("Frame")
PWF:RegisterEvent("PLAYER_ENTERING_WORLD")
PWF:SetScript("OnEvent", function(self)
local noop = function() end
 
local f = WatchFrame
f:EnableMouse(false)
f:ClearAllPoints()
f:SetClampedToScreen(false)
f:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 30, 17)
f:SetPoint("BOTTOMLEFT", UIParent, "LEFT", 30, 0)
f:SetScale(1.2)
f.ClearAllPoints = noop
f.SetPoint = noop
 
local h = WatchFrameHeader
h:SetHeight(1)
h.SetHeight = noop
h:Hide()
h.Show = noop
 
local b = WatchFrameCollapseExpandButton
b:ClearAllPoints()
b:SetPoint("TOPLEFT", UIParent)
b:SetSize(24, 24)
b:SetAlpha(0)
b:SetScript("OnEnter", function(b) b:SetAlpha(1) end)
b:SetScript("OnLeave", function(b) b:SetAlpha(0) end)
b:RegisterForClicks("LeftButtonUp", "RightButtonUp")
b:SetScript("OnClick", function(b,btn)
if btn == "LeftButton" then
return WatchFrame_CollapseExpandButton_OnClick(b, btn)
else
return WatchFrameHeader_OnClick(WatchFrameHeader, btn)
end
end)
 
WatchFrame_SetWidth(1)
WatchFrame_Update(WatchFrame)
 
self:UnregisterAllEvents()
self:SetScript("OnEvent", nil)
end)
\ No newline at end of file Property changes : Added: svn:eol-style + native