Compare with Previous | Blame | View Log
--[[-------------------------------------------------------------------- PhanxWatchFrame Copyright (c) 2009-2014 Phanx <addons@phanx.net>. All rights reserved. Please DO NOT upload this addon to other websites, or post modified versions of it. However, you are welcome to use any/all of its code in your own addon, as long as you do not use my name or the name of this addon ANYWHERE in your addon, including in its name, outside of an optional attribution. You are also welcome to include this addon WITHOUT CHANGES in compilations posted on Curse and/or WoWInterface. ----------------------------------------------------------------------]] hooksecurefunc("WatchFrameItem_UpdateCooldown", function(button) if button and PhanxBorder and not button.BorderTextures then button:SetSize(32, 32) 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) 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 IsModifierKeyDown() 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:SetMovable(true) f:SetUserPlaced(true) f:SetClampedToScreen(false) f:ClearAllPoints() f:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 30, 10) f:SetPoint("BOTTOMLEFT", UIParent, "LEFT", 30, -100) f:SetScale(1.1) local h = WatchFrameHeader h:SetHeight(1) h:Hide() h.SetHeight = noop h.Show = noop local b = WatchFrameCollapseExpandButton b:ClearAllPoints() b:SetPoint("TOPLEFT", UIParent) 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)