/trunk/Who Framed Watcher Wabbit
## Interface: 50200 |
## Interface: 60000 |
## Name: Who Framed Watcher Wabbit? |
## Version: 1.9 |
## Version: 2.0 |
## Notes: Various tweaks to improve the quest watch frame |
## SavedVariables: WFWWDB |
## SavedVariablesPerCharacter: WFWWPCDB |
libs\LibSharedMedia-3.0\lib.xml |
libs\AceGUI-3.0-SharedMediaWidgets\widget.xml |
bindings.xml |
wfww.lua |
TreeGroup Container |
Container that uses a tree control to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TreeGroup", 34 |
local Type, Version = "TreeGroup", 36 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
if frame.obj.noupdate then return end |
local self = frame.obj |
local status = self.status or self.localstatus |
status.scrollvalue = value |
status.scrollvalue = floor(value + 0.5) |
self:RefreshTree() |
AceGUI:ClearFocus() |
end |
Button Widget |
Graphical Button. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Button", 22 |
local Type, Version = "Button", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self:SetHeight(24) |
self:SetWidth(200) |
self:SetDisabled(false) |
self:SetAutoWidth(false) |
self:SetText() |
end, |
["SetText"] = function(self, text) |
self.text:SetText(text) |
if self.autoWidth then |
self:SetWidth(self.text:GetStringWidth() + 30) |
end |
end, |
["SetAutoWidth"] = function(self, autoWidth) |
self.autoWidth = autoWidth |
if self.autoWidth then |
self:SetWidth(self.text:GetStringWidth() + 30) |
end |
end, |
["SetDisabled"] = function(self, disabled) |
self.disabled = disabled |
--[[----------------------------------------------------------------------------- |
ColorPicker Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "ColorPicker", 21 |
local Type, Version = "ColorPicker", 22 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local self = frame.obj |
if not self.disabled then |
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") |
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) |
ColorPickerFrame:SetClampedToScreen(true) |
ColorPickerFrame.func = function() |
Slider Widget |
Graphical Slider, like, for Range values. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Slider", 20 |
local Type, Version = "Slider", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local self = frame.obj |
if not frame.setup then |
local newvalue = frame:GetValue() |
if self.step and self.step > 0 then |
local min_value = self.min or 0 |
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value |
end |
if newvalue ~= self.value and not self.disabled then |
self.value = newvalue |
self:Fire("OnValueChanged", newvalue) |
--[[ $Id: AceGUIWidget-DropDown.lua 1029 2011-06-10 23:10:58Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 1116 2014-10-12 08:15:46Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
do |
local widgetType = "Dropdown" |
local widgetVersion = 25 |
local widgetVersion = 30 |
--[[ Static data ]]-- |
--[[ UI event handler ]]-- |
local function Control_OnEnter(this) |
this.obj.button:LockHighlight() |
this.obj:Fire("OnEnter") |
end |
local function Control_OnLeave(this) |
this.obj.button:UnlockHighlight() |
this.obj:Fire("OnLeave") |
end |
AceGUI:ClearFocus() |
else |
self.open = true |
self.pullout:SetWidth(self.frame:GetWidth()) |
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth()) |
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0) |
AceGUI:SetFocus(self) |
end |
end |
self.open = true |
self:Fire("OnOpened") |
end |
local function OnPulloutClose(this) |
self:SetHeight(44) |
self:SetWidth(200) |
self:SetLabel() |
self:SetPulloutWidth(nil) |
end |
-- exported, AceGUI callback |
if disabled then |
self.text:SetTextColor(0.5,0.5,0.5) |
self.button:Disable() |
self.button_cover:Disable() |
self.label:SetTextColor(0.5,0.5,0.5) |
else |
self.button:Enable() |
self.button_cover:Enable() |
self.label:SetTextColor(1,.82,0) |
self.text:SetTextColor(1,1,1) |
end |
if text and text ~= "" then |
self.label:SetText(text) |
self.label:Show() |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-18) |
self:SetHeight(44) |
self.alignoffset = 30 |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14) |
self:SetHeight(40) |
self.alignoffset = 26 |
else |
self.label:SetText("") |
self.label:Hide() |
return self.multiselect |
end |
local function SetPulloutWidth(self, width) |
self.pulloutWidth = width |
end |
--[[ Constructor ]]-- |
local function Constructor() |
self.GetMultiselect = GetMultiselect |
self.SetItemValue = SetItemValue |
self.SetItemDisabled = SetItemDisabled |
self.SetPulloutWidth = SetPulloutWidth |
self.alignoffset = 30 |
self.alignoffset = 26 |
frame:SetScript("OnHide",Dropdown_OnHide) |
button:SetScript("OnLeave",Control_OnLeave) |
button:SetScript("OnClick",Dropdown_TogglePullout) |
local button_cover = CreateFrame("BUTTON",nil,self.frame) |
self.button_cover = button_cover |
button_cover.obj = self |
button_cover:SetPoint("TOPLEFT",self.frame,"BOTTOMLEFT",0,25) |
button_cover:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT") |
button_cover:SetScript("OnEnter",Control_OnEnter) |
button_cover:SetScript("OnLeave",Control_OnLeave) |
button_cover:SetScript("OnClick",Dropdown_TogglePullout) |
local text = _G[dropdown:GetName() .. "Text"] |
self.text = text |
text.obj = self |
--[[----------------------------------------------------------------------------- |
EditBox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "EditBox", 24 |
local Type, Version = "EditBox", 25 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
elseif type == "macro" then |
local name = GetMacroInfo(id) |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
end |
HideButton(self) |
AceGUI:ClearFocus() |
-- f:AddChild(btn) |
-- @class file |
-- @name AceGUI-3.0 |
-- @release $Id: AceGUI-3.0.lua 924 2010-05-13 15:12:20Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 33 |
-- @release $Id: AceGUI-3.0.lua 1102 2013-10-25 14:15:23Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 34 |
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) |
if not AceGUI then return end -- No upgrade needed |
end |
end) |
local layoutrecursionblock = nil |
local function safelayoutcall(object, func, ...) |
layoutrecursionblock = true |
object[func](object, ...) |
layoutrecursionblock = nil |
end |
AceGUI:RegisterLayout("Flow", |
function(content, children) |
if layoutrecursionblock then return end |
--used height so far |
local height = 0 |
--width used in the current row |
end |
if child.width == "fill" then |
child:SetWidth(width) |
safelayoutcall(child, "SetWidth", width) |
frame:SetPoint("RIGHT", content) |
usedwidth = 0 |
rowoffset = child.alignoffset or (rowheight / 2) |
rowstartoffset = rowoffset |
elseif child.width == "relative" then |
child:SetWidth(width * child.relWidth) |
safelayoutcall(child, "SetWidth", width * child.relWidth) |
if child.DoLayout then |
child:DoLayout() |
--[[ |
Name: LibSharedMedia-3.0 |
Revision: $Revision: 74 $ |
Revision: $Revision: 89 $ |
Author: Elkano (elkano@gmx.de) |
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) |
Website: http://www.wowace.com/projects/libsharedmedia-3-0/ |
License: LGPL v2.1 |
]] |
local MAJOR, MINOR = "LibSharedMedia-3.0", 5000402 -- 5.0.4 v2 / increase manually on changes |
local MAJOR, MINOR = "LibSharedMedia-3.0", 6000201 -- 6.0.2 v1 / increase manually on changes |
local lib = LibStub:NewLibrary(MAJOR, MINOR) |
if not lib then return end |
-- BACKGROUND |
if not lib.MediaTable.background then lib.MediaTable.background = {} end |
lib.MediaTable.background["None"] = [[]] |
lib.MediaTable.background["Blizzard Collections Background"] = [[Interface\Collections\CollectionsBackgroundTile]] |
lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]] |
lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]] |
lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]] |
lib.MediaTable.background["Blizzard Garrison Background"] = [[Interface\Garrison\GarrisonUIBackground]] |
lib.MediaTable.background["Blizzard Garrison Background 2"] = [[Interface\Garrison\GarrisonUIBackground2]] |
lib.MediaTable.background["Blizzard Garrison Background 3"] = [[Interface\Garrison\GarrisonMissionUIInfoBoxBackgroundTile]] |
lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]] |
lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]] |
lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]] |
if not lib.MediaTable.font then lib.MediaTable.font = {} end |
local SML_MT_font = lib.MediaTable.font |
--[[ |
All font files are currently in all clients, the following table depicts which font supports which charset as of 5.0.4 |
Fonts were checked using langcover.pl from DejaVu fonts (http://sourceforge.net/projects/dejavu/) and FontForge (http://fontforge.org/) |
latin means check for: de, en, es, fr, it, pt |
file name latin koKR ruRU zhCN zhTW |
2002.ttf 2002 X X X - - |
2002B.ttf 2002 Bold X X X - - |
bKAI00M.ttf AR Kaiti Medium B5 - - - - X |
bLEI00D.ttf AR Leisu Demi B5 - - - - X |
FRIZQT__.TTF Friz Quadrata TT X - - - - |
FRIZQT___CYR.TTF FrizQuadrataCTT - - X - - |
FRIZQT___CYR.TTF FrizQuadrataCTT x - X - - |
K_Damage.TTF YDIWingsM - X X - - |
K_Pagetext.TTF MoK X X X - - |
MORPHEUS.TTF Morpheus X - - - - |
NIM_____.ttf Nimrod MT X - X - - |
SKURRI.TTF Skurri X - - - - |
SKURRI_CYR.TTF Skurri X - X - - |
WARNING: Although FRIZQT___CYR is available on western clients, it doesn't support special European characters e.g. é, ï, ö |
Due to this, we cannot use it as a replacement for FRIZQT__.TTF |
]] |
if locale == "koKR" then |
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) |
end |
mediatype = mediatype:lower() |
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end |
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end |
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end |
local mtable = mediaTable[mediatype] |
if mtable[key] then return false end |
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". |
-- @class file |
-- @name AceConfigRegistry-3.0 |
-- @release $Id: AceConfigRegistry-3.0.lua 1045 2011-12-09 17:58:40Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 14 |
-- @release $Id: AceConfigRegistry-3.0.lua 1105 2013-12-08 22:11:58Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 15 |
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigRegistry then return end |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param options The options table, OR a function reference that generates it on demand. \\ |
-- See the top of the page for info on arguments passed to such functions. |
function AceConfigRegistry:RegisterOptionsTable(appName, options) |
-- @param skipValidation Skip options table validation (primarily useful for extremely huge options, with a noticeable slowdown) |
function AceConfigRegistry:RegisterOptionsTable(appName, options, skipValidation) |
if type(options)=="table" then |
if options.type~="group" then -- quick sanity checker |
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2) |
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl) |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
if not AceConfigRegistry.validated[uiType][appName] then |
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then |
AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
local tab = assert(options(uiType, uiName, appName)) |
if not AceConfigRegistry.validated[uiType][appName] then |
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then |
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. |
-- @class file |
-- @name AceConfigDialog-3.0 |
-- @release $Id: AceConfigDialog-3.0.lua 1049 2012-04-02 13:22:10Z mikk $ |
-- @release $Id: AceConfigDialog-3.0.lua 1113 2014-09-11 20:18:16Z nevcairiel $ |
local LibStub = LibStub |
local MAJOR, MINOR = "AceConfigDialog-3.0", 57 |
local MAJOR, MINOR = "AceConfigDialog-3.0", 59 |
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigDialog then return end |
t.text = message |
t.button1 = ACCEPT |
t.button2 = CANCEL |
t.preferredIndex = 3 |
t.preferredIndex = STATICPOPUP_NUMDIALOGS |
local dialog, oldstrata |
t.OnAccept = function() |
safecall(func, unpack(t)) |
tinsert(path, (select(n, ...))) |
end |
local option = options |
if type(container) == "table" and container.type == "BlizOptionsGroup" and #path > 0 then |
for i = 1, #path do |
option = options.args[path[i]] |
end |
name = format("%s - %s", name, GetOptionsMemberValue("name", option, options, path, appName)) |
end |
--if a container is given feed into that |
if container then |
f = container |
--CREDITS: Xrystal for nUI support code, seebs for line spacing code |
-------------------------------------------------------------------- |
-- STARTING OVER FROM SCRATCH!! WFWW 2.0! -- |
local skin = "Interface\\AddOns\\rActionButtonStyler\\media\\gloss.tga" --the normal button skin texture |
local hover = "Interface\\AddOns\\rActionButtonStyler\\media\\hover.tga" --the texture when hovering your mouse over the button |
local pushed = "Interface\\AddOns\\rActionButtonStyler\\media\\pushed.tga" --the texture when pushing the button |
--credit line |
local WFContainer = CreateFrame("Frame", "WFContainer", UIParent) |
local db, SetSize, MoveWatchFrame, Appearance, FontChanges, line --, WFWW_BF, itembtn |
local nextline = 1 |
local nextbutton = 1 |
--rActionButtonStyler texture lines (or see about how to register these buttons with rABS???) |
local ObjectiveTrackerFrame = ObjectiveTrackerFrame |
local minimizeButton = ObjectiveTrackerFrame.HeaderMenu.MinimizeButton |
local otfHeader = ObjectiveTrackerFrame.HeaderMenu |
local otfQuests = ObjectiveTrackerBlocksFrame.QuestHeader |
local otfAchievements = ObjectiveTrackerBlocksFrame.AchievementHeader |
local otfScenarios = ObjectiveTrackerBlocksFrame.ScenarioHeader |
local LSM = LibStub("LibSharedMedia-3.0") |
local widgetLists = AceGUIWidgetLSMlists |
local GameTooltip = GameTooltip |
local WatchFrameCollapseExpandButton = WatchFrameCollapseExpandButton |
local positions = {"TOP", "TOPRIGHT", "TOPLEFT", |
"BOTTOM", "BOTTOMRIGHT", "BOTTOMLEFT", |
"RIGHT", "LEFT", "CENTER"} |
local fontFlags = {"None", "Outline", "Monochrome Outline"} --, "Monochrome"} |
local wideFrame = GetCVar("watchFrameWidth") |
local _,class = UnitClass("player") |
local classColor |
local db, font, classColor |
local WFWWSkinnedHeaders = {} |
local WFWWSkinnedLines = {} |
local tinsert = tinsert |
local MoveObjectiveTracker, SetSize, Appearance, FontChanges |
local OTFContainer = CreateFrame("Frame", "OTFContainer", UIParent) |
local defaults = { |
bg = "Solid", |
anchorPoint = "TOPRIGHT", |
xOffset = "-15", |
yOffset = "-250", |
height = 500, |
height = 600, |
bgColor = {r = .1, g = .1, b = .1, a = .6}, |
borderColor = {r = 1, g = 1, b = 1}, |
borderAlpha = .8, |
db.anchorPoint = positions[anchor] |
db.xOffset = "0" |
db.yOffset = "0" |
MoveWatchFrame() |
MoveObjectiveTracker() |
end, |
order = 1, |
}, |
xOffset = "0" |
end |
db.xOffset = xOffset |
MoveWatchFrame() |
MoveObjectiveTracker() |
end, |
order = 2, |
}, |
yOffset = "0" |
end |
db.yOffset = yOffset |
MoveWatchFrame() |
MoveObjectiveTracker() |
end, |
order = 3, |
}, |
end, |
set = function(self, font) |
db.font = font |
nextline = 1 |
WatchFrame_Update() |
FontChanges() |
end, |
order = 6, |
}, |
get = function() return db.fontSize end, |
set = function(_,size) |
db.fontSize = size |
nextline = 1 |
WatchFrame_Update() |
FontChanges() |
end, |
order = 7, |
}, |
end, |
set = function(_,key) |
db.fontFlag = fontFlags[key] |
nextline = 1 --start over from the beginning |
WatchFrame_Update() |
FontChanges() |
end, |
order = 8, |
}, |
get = function() return db.disableShadow end, |
set = function() |
db.disableShadow = not db.disableShadow |
nextline = 1 |
FontChanges() |
end, |
order = 8.5, |
get = function() return db.questSpacing end, |
set = function(_,size) |
db.questSpacing = size |
WATCHFRAME_QUEST_OFFSET = size |
WatchFrame_Update() |
DEFAULT_OBJECTIVE_TRACKER_MODULE.blockOffsetY = -db.questSpacing |
ObjectiveTracker_Update() |
end, |
order = 8.51, |
}, |
lineSpacing = { |
--[[lineSpacing = { |
name = "Line Spacing", |
desc = "Change the spacing between lines.", |
type = "range", |
get = function() return db.lineSpacing end, |
set = function(_,size) |
db.lineSpacing = size |
WATCHFRAME_LINEHEIGHT = db.fontSize + size |
WatchFrame_Update() |
otfQuests.module.linespacing = db.lineSpacing |
otfAchievements.module.linespacing = db.lineSpacing |
--ObjectiveTracker_Update() |
end, |
order = 8.52, |
}, |
},]] |
spacer2 = { |
name = " ", |
type = "description", |
set = function() |
db.hideFrame = not db.hideFrame |
if db.hideFrame and GetNumTrackedAchievements() == 0 and GetNumQuestWatches() == 0 then |
WFContainer:SetAlpha(0) |
WatchFrameCollapseExpandButton:EnableMouse(false) |
OTFContainer:SetAlpha(0) |
minimizeButton:EnableMouse(false) |
else |
WFContainer:SetAlpha(1) |
WatchFrameCollapseExpandButton:EnableMouse(true) |
OTFContainer:SetAlpha(1) |
minimizeButton:EnableMouse(true) |
end |
end, |
order = 15, |
set = function() |
db.instance = not db.instance |
if db.instance then |
WFContainer:RegisterEvent("PLAYER_ENTERING_WORLD") |
OTFContainer:RegisterEvent("PLAYER_ENTERING_WORLD") |
else |
WFContainer:UnregisterEvent("PLAYER_ENTERING_WORLD") |
OTFContainer:UnregisterEvent("PLAYER_ENTERING_WORLD") |
end |
end, |
order = 15.2, |
set = function() |
db.petBattle = not db.petBattle |
if db.petBattle then |
WFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
WFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
OTFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
OTFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
else |
WFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
WFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
OTFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
OTFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
end |
end, |
order = 15.5, |
type = "keybinding", |
get = function() return db.keybind end, |
set = function(_,key) |
SetOverrideBinding(WFContainer, false, db.keybind, nil) --clear old binding |
SetOverrideBinding(OTFContainer, false, db.keybind, nil) --clear old binding |
if key ~= "" then --set new |
SetOverrideBinding(WFContainer, false, key, "CLICK WatchFrameCollapseExpandButton:LeftButton") |
local bound = SetOverrideBinding(OTFContainer, false, key, "WFWWCOLLAPSE") |
end |
db.keybind = key |
end, |
}, |
} |
function MoveWatchFrame() |
WFContainer:ClearAllPoints() |
WFContainer:SetPoint(db.anchorPoint, UIParent, db.anchorPoint, db.xOffset, db.yOffset) |
function MoveObjectiveTracker() --declared local at top of file |
OTFContainer:ClearAllPoints() |
OTFContainer:SetPoint(db.anchorPoint, UIParent, db.anchorPoint, db.xOffset, db.yOffset) |
end |
function SetSize() |
WFContainer:SetHeight(db.height) |
if wideFrame == "1" then |
WFContainer:SetWidth(350) |
else |
WFContainer:SetWidth(250) |
OTFContainer:SetHeight(db.height) |
OTFContainer:SetWidth(280) |
OTFContainer:SetScale(db.scale) |
end |
function OTFContainer.ExpandObjectiveTracker() |
if ObjectiveTrackerFrame.collapsed then |
OTFContainer:SetHeight(db.height) |
OTFContainer:SetWidth(280) |
ObjectiveTracker_MinimizeButton_OnClick() --default function called by OnClick |
end |
WFContainer:SetScale(db.scale) |
if GetNumTrackedAchievements() == 0 and GetNumQuestWatches() == 0 and GetNumAutoQuestPopUps() == 0 then |
--if our tracker is empty, still show "Objectives" text |
otfHeader.Title:Show() |
elseif not WFWWPCDB.collapsed then --if not empty and not collapsed |
otfHeader.Title:Hide() |
end |
end |
local ExpandObjectiveTracker = OTFContainer.ExpandObjectiveTracker |
function OTFContainer.CollapseObjectiveTracker() |
if not ObjectiveTrackerFrame.collapsed then |
OTFContainer:SetHeight(30) |
OTFContainer:SetWidth(150) |
ObjectiveTracker_MinimizeButton_OnClick() --default function called by OnClick |
end |
end |
local CollapseObjectiveTracker = OTFContainer.CollapseObjectiveTracker |
function Appearance() |
WFContainer:SetBackdrop({ |
OTFContainer:SetBackdrop({ |
bgFile = LSM:Fetch("background", db.bg), |
edgeFile = LSM:Fetch("border", db.border), |
edgeSize = db.borderWidth, |
insets = {left=db.inset,right=db.inset,top=db.inset,bottom=db.inset} |
}) |
WFContainer:SetBackdropColor(db.bgColor.r,db.bgColor.g,db.bgColor.b,db.bgColor.a) |
OTFContainer:SetBackdropColor(db.bgColor.r,db.bgColor.g,db.bgColor.b,db.bgColor.a) |
if db.classBorder then |
WFContainer:SetBackdropBorderColor(classColor.r,classColor.g,classColor.b,db.borderAlpha) |
OTFContainer:SetBackdropBorderColor(classColor.r,classColor.g,classColor.b,db.borderAlpha) |
else |
WFContainer:SetBackdropBorderColor(db.borderColor.r,db.borderColor.g,db.borderColor.b,db.borderAlpha) |
OTFContainer:SetBackdropBorderColor(db.borderColor.r,db.borderColor.g,db.borderColor.b,db.borderAlpha) |
end |
end |
function FontChanges() |
local font = LSM:Fetch("font", db.font) |
WatchFrameTitle:SetFont(font, db.fontSize, db.fontFlag) |
for i = nextline, 50 do |
line = _G["WatchFrameLine"..i] |
if line then |
line.text:SetFont(font, db.fontSize, db.fontFlag) |
line.dash:SetFont(font, db.fontSize, db.fontFlag) |
if db.disableShadow then |
line.text:SetShadowColor(0,0,0,0) |
line.dash:SetShadowColor(0,0,0,0) |
else |
line.text:SetShadowColor(0,0,0,1) |
line.dash:SetShadowColor(0,0,0,1) |
end |
else |
nextline = i --so we only have to change new lines during the hook |
break |
end |
font = LSM:Fetch("font", db.font) |
local shadow = db.disableShadow and 0 or 1 |
otfHeader.Title:SetFont(font, db.fontSize, db.fontFlag) |
otfHeader.Title:SetShadowColor(0,0,0,shadow) |
otfQuests.Text:SetFont(font, db.fontSize+2, db.fontFlag) |
otfQuests.Text:SetShadowColor(0,0,0,shadow) |
otfAchievements.Text:SetFont(font, db.fontSize+2, db.fontFlag) |
otfAchievements.Text:SetShadowColor(0,0,0,shadow) |
otfScenarios.Text:SetFont(font, db.fontSize+2, db.fontFlag) |
otfScenarios.Text:SetShadowColor(0,0,0,shadow) |
for k,v in pairs(WFWWSkinnedHeaders) do |
v:SetFont(font, db.fontSize, db.fontFlag) |
v:SetShadowColor(0,0,0,shadow) |
end |
end |
local function SkinButtons() |
if IsAddOnLoaded("rActionButtonStyler") then |
local colorR,colorG,colorB = ActionButton1NormalTexture:GetVertexColor() |
for i = nextbutton, 15 do |
itembtn = _G["WatchFrameItem"..i] |
if itembtn then |
itembtn:SetHighlightTexture(hover) |
itembtn:SetPushedTexture(pushed) |
border = _G[itembtn:GetName().."NormalTexture"] |
border:SetAllPoints() |
border:SetTexture(skin) |
border:SetVertexColor(colorR, colorG, colorB) |
else |
nextbutton = i |
break |
end |
end |
for k,v in pairs(WFWWSkinnedLines) do |
v.Text:SetFont(font, db.fontSize, db.fontFlag) |
v.Text:SetShadowColor(0,0,0,shadow) |
v.Dash:SetFont(font, db.fontSize, db.fontFlag) |
v.Dash:SetShadowColor(0,0,0,shadow) |
end |
ObjectiveTracker_Update() |
end |
local function SetUpContainer() |
--keep nUI from hogging the WatchFrame - thanks Xrystal! |
if IsAddOnLoaded("nUI") then |
nUI_ResetWatchFrame = function() end |
nUI_Movers:lockFrame(WatchFrame, false, nil) |
nUI_Options.movedWatchFrame = true |
end |
--nUI code here if desired |
MoveWatchFrame() |
MoveObjectiveTracker() |
SetSize() |
Appearance() |
SkinButtons() |
--SkinButtons() --add later for rABS or Masque(?) support |
if db.keybind ~= "" then |
SetOverrideBinding(WFContainer, false, db.keybind, "CLICK WatchFrameCollapseExpandButton:LeftButton") |
end |
WATCHFRAME_QUEST_OFFSET = db.questSpacing |
WATCHFRAME_LINEHEIGHT = db.fontSize + db.lineSpacing |
SetOverrideBinding(OTFContainer, false, db.keybind, "CLICK minimizeButton:LeftButton") |
end |
DEFAULT_OBJECTIVE_TRACKER_MODULE.blockOffsetY = -db.questSpacing |
--otfQuests.module.linespacing = db.lineSpacing |
--otfAchievements.module.linespacing = db.lineSpacing |
--make sure fonts for other modules are good, too |
hooksecurefunc("WatchFrame_Update", function() |
FontChanges() |
SkinButtons() |
if db.hideFrame then |
if GetNumTrackedAchievements() == 0 and GetNumQuestWatches() == 0 then |
WFContainer:SetAlpha(0) |
WatchFrameCollapseExpandButton:EnableMouse(false) |
else |
WFContainer:SetAlpha(1) |
WatchFrameCollapseExpandButton:EnableMouse(true) |
end |
local function HookForUpdates(module, block, objectiveKey, text, lineType, useFullHeight, hideDash, colorStyle) |
local header = block.HeaderText |
local line = block.lines[objectiveKey] |
if not header.wfwwSkinned then |
header:SetFont(font, db.fontSize, db.fontFlag) |
header:SetShadowColor(0,0,0,db.disableShadow and 0 or 1) |
tinsert(WFWWSkinnedHeaders, header) |
header.wfwwSkinned = true |
end |
end) |
WatchFrame_Update() |
hooksecurefunc("WatchFrameLinkButtonTemplate_Highlight", function(self, enter) |
if enter then |
local id = self.index |
local watchType = self.type |
if watchType == "QUEST" then |
GameTooltip:SetOwner(self) |
GameTooltip:SetHyperlink(GetQuestLink(GetQuestIndexForWatch(id))) |
GameTooltip:Show() |
elseif watchType == "ACHIEVEMENT" then |
GameTooltip:SetOwner(self) |
GameTooltip:SetHyperlink(GetAchievementLink(id)) |
GameTooltip:Show() |
end |
else |
GameTooltip:Hide() |
if not line.wfwwSkinned then |
line.Text:SetFont(font, db.fontSize, db.fontFlag) |
line.Text:SetShadowColor(0,0,0,db.disableShadow and 0 or 1) |
line.Dash:SetFont(font, db.fontSize, db.fontFlag) |
line.Dash:SetShadowColor(0,0,0,db.disableShadow and 0 or 1) |
tinsert(WFWWSkinnedLines, line) |
line.wfwwSkinned = true |
end |
end) |
end |
for i = 1, #ObjectiveTrackerFrame.MODULES do |
hooksecurefunc(ObjectiveTrackerFrame.MODULES[i], "AddObjective", HookForUpdates) |
end |
FontChanges() |
WatchFrame:SetParent(WFContainer) |
WatchFrame:SetClampedToScreen(false) |
WatchFrame:ClearAllPoints() |
WatchFrame.ClearAllPoints = function() end |
WatchFrame:SetPoint("TOPLEFT", 32,-2.5) |
WatchFrame:SetPoint("BOTTOMRIGHT", 4,0) |
WatchFrame.SetPoint = function() end |
ObjectiveTrackerFrame:SetParent(OTFContainer) |
ObjectiveTrackerFrame:SetClampedToScreen(false) |
ObjectiveTrackerFrame:ClearAllPoints() |
ObjectiveTrackerFrame.ClearAllPoints = function() end |
ObjectiveTrackerFrame:SetPoint("TOPLEFT", 35, -5) |
ObjectiveTrackerFrame:SetPoint("BOTTOMRIGHT", -10, 5) |
ObjectiveTrackerFrame.SetPoint = function() end |
WatchFrameTitle:SetParent(WFContainer) |
WatchFrameCollapseExpandButton:SetParent(WFContainer) |
WatchFrameCollapseExpandButton:Raise() --let us click it even if header text is too big |
WatchFrameTitle:Show() |
WatchFrameCollapseExpandButton:Show() |
WatchFrameTitle.Hide = function() end |
WatchFrameCollapseExpandButton.Hide = function() WatchFrameTitle:SetText(OBJECTIVES_TRACKER_LABEL)end |
WatchFrameCollapseExpandButton:Enable() |
WatchFrameCollapseExpandButton.Disable = function() end |
otfQuests.animateReason = 0 |
otfAchievements.animateReason = 0 |
if WFWWPCDB.collapsed then --remember if watchframe was collapsed on last logout |
WatchFrame_CollapseExpandButton_OnClick() --default function called by OnClick |
WFContainer:SetHeight(30) |
WFContainer:SetWidth(150) |
minimizeButton:Show() |
minimizeButton.Hide = function() end |
otfHeader:Show() |
otfHeader.Hide = function() end |
hooksecurefunc("ObjectiveTracker_MinimizeButton_OnClick", function() |
WFWWPCDB.collapsed = ObjectiveTrackerFrame.collapsed |
end) |
if WFWWPCDB.collapsed then --recall if watchframe was collapsed on last logout |
CollapseObjectiveTracker() |
else |
ExpandObjectiveTracker() |
end |
WatchFrameCollapseExpandButton:RegisterForClicks("AnyDown") |
WatchFrameCollapseExpandButton:SetScript("OnClick", function(self,btn) |
minimizeButton:RegisterForClicks("AnyDown") |
minimizeButton:SetScript("OnClick", function(self,btn) |
if IsShiftKeyDown() then |
ToggleAchievementFrame() |
elseif IsAltKeyDown() then |
InterfaceOptionsFrame_OpenToCategory("Who Framed Watcher Wabbit?") |
InterfaceOptionsFrame_OpenToCategory("Who Framed Watcher Wabbit?") |
elseif btn == "RightButton" then |
ToggleFrame(QuestLogFrame) |
ToggleFrame(WorldMapFrame) |
else |
WatchFrame_CollapseExpandButton_OnClick() --default function called by OnClick |
if not WFWWPCDB.collapsed then --if the container's not collapsed, collapse it |
WFContainer:SetHeight(30) |
WFContainer:SetWidth(150) |
WFWWPCDB.collapsed = true |
CollapseObjectiveTracker() |
else |
WFContainer:SetHeight(db.height) |
if wideFrame == "1" then |
WFContainer:SetWidth(350) |
else |
WFContainer:SetWidth(250) |
end |
WFWWPCDB.collapsed = false |
ExpandObjectiveTracker() |
end |
end |
end) |
--keep the watch frame and container in sync with each other |
hooksecurefunc("WatchFrame_Expand", function(self) |
if WFWWPCDB.collapsed and GetNumAutoQuestPopUps() == 0 then |
WatchFrame_Collapse(self) |
end |
end) |
WatchFrameCollapseExpandButton:SetScript("OnEnter", function(self) |
minimizeButton:SetScript("OnEnter", function(self) |
GameTooltip:SetOwner(self, "ANCHOR_TOP") |
GameTooltip:AddLine("Who Framed Watcher Wabbit?",1,1,1) |
if WatchFrame.collapsed then |
if ObjectiveTrackerFrame.collapsed then |
GameTooltip:AddLine("Left-click to expand the objectives tracker.") |
else |
GameTooltip:AddLine("Left-click to minimize the objectives tracker.") |
GameTooltip:AddLine("Alt-click to open the Who Framed Watcher Wabbit? options.") |
GameTooltip:Show() |
end) |
WatchFrameCollapseExpandButton:SetScript("OnLeave", function() GameTooltip:Hide() end) |
minimizeButton:SetScript("OnLeave", function() GameTooltip:Hide() end) |
ObjectiveTracker_Update() |
end |
local function SetUpDB() |
SetUpDB() |
LibStub("AceConfig-3.0"):RegisterOptionsTable("Who Framed Watcher Wabbit?", options) |
WFContainer.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Who Framed Watcher Wabbit?", "Who Framed Watcher Wabbit?") |
SlashCmdList["WFWW"] = function() InterfaceOptionsFrame_OpenToCategory("Who Framed Watcher Wabbit?") end |
OTFContainer.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Who Framed Watcher Wabbit?", "Who Framed Watcher Wabbit?") |
SlashCmdList["WFWW"] = function() |
InterfaceOptionsFrame_OpenToCategory("Who Framed Watcher Wabbit?") |
InterfaceOptionsFrame_OpenToCategory("Who Framed Watcher Wabbit?") |
end |
SLASH_WFWW1 = "/wfww" |
classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class] |
end |
if not db.instance then |
WFContainer:UnregisterEvent("PLAYER_ENTERING_WORLD") |
OTFContainer:UnregisterEvent("PLAYER_ENTERING_WORLD") |
end |
if not db.petBattle then |
WFContainer:UnregisterEvent("PET_BATTLE_OPENING_START") |
WFContainer:UnregisterEvent("PET_BATTLE_CLOSE") |
if db.petBattle then |
OTFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
OTFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
end |
WFContainer:RegisterEvent("QUEST_WATCH_UPDATE") |
WFContainer:RegisterEvent("QUEST_AUTOCOMPLETE") |
WFContainer:RegisterEvent("CVAR_UPDATE") |
WFContainer:RegisterEvent("PET_BATTLE_OPENING_START") |
WFContainer:RegisterEvent("PET_BATTLE_CLOSE") |
OTFContainer:RegisterEvent("QUEST_AUTOCOMPLETE") |
OTFContainer:RegisterEvent("QUEST_WATCH_LIST_CHANGED") |
OTFContainer:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED") |
local notCollapsed |
WFContainer:SetScript("OnEvent", function(_,event,...) |
OTFContainer:SetScript("OnEvent", function(_, event, ...) |
if event == "PLAYER_ENTERING_WORLD" then |
if IsInInstance() and not WFWWPCDB.collapsed then |
--if you go in the instance and the WF isn't collapsed... |
WatchFrameCollapseExpandButton:Click() --collapse |
CollapseObjectiveTracker() --collapse |
end |
elseif event == "PET_BATTLE_OPENING_START" and not WFWWPCDB.collapsed then |
notCollapsed = true |
WatchFrameCollapseExpandButton:Click() |
notCollapsed = true --if it was open before pet battle |
CollapseObjectiveTracker() |
elseif event == "PET_BATTLE_CLOSE" and notCollapsed then |
ExpandObjectiveTracker() --open again after pet battle if it was open before |
notCollapsed = false |
WatchFrameCollapseExpandButton:Click() |
elseif event == "CVAR_UPDATE" then |
local cvar,value = ... |
if cvar == "WATCH_FRAME_WIDTH_TEXT" then |
if not WatchFrame.userCollapsed then |
if value == "1" then |
WFContainer:SetWidth(350) |
else |
WFContainer:SetWidth(250) |
end |
elseif event == "QUEST_WATCH_LIST_CHANGED" or event == "TRACKED_ACHIEVEMENT_LIST_CHANGED" then |
if GetNumTrackedAchievements() == 0 and GetNumQuestWatches() == 0 and GetNumAutoQuestPopUps() == 0 then |
--if our tracker is empty |
otfHeader.Title:Show() |
if db.hideFrame then |
OTFContainer:SetAlpha(0) |
minimizeButton:EnableMouse(false) |
end |
wideFrame = value |
elseif not WFWWPCDB.collapsed then --if not empty and not collapsed |
otfHeader.Title:Hide() |
if db.hideFrame then |
OTFContainer:SetAlpha(1) |
minimizeButton:EnableMouse(true) |
end |
end |
else |
local index = ... |
if event == "QUEST_AUTOCOMPLETE" or index == 0 then |
if WFWWPCDB.collapsed then |
WFContainer:SetHeight(db.height) |
if wideFrame == "1" then |
WFContainer:SetWidth(350) |
if IsInInstance() and db.instance then |
return |
else |
WFContainer:SetWidth(250) |
ExpandObjectiveTracker() |
end |
WFWWPCDB.collapsed = false |
end |
end |
end |
end) |
end |
WFContainer:RegisterEvent("PLAYER_ENTERING_WORLD") |
--local f = CreateFrame("Frame") --need to create a slight delay to get rid of errors and glitches |
--f:Hide() |
--f.elapsed = 0 |
--[[f:SetScript("OnUpdate", function(self, elapsed) |
f.elapsed = f.elapsed + elapsed |
if f.elapsed > .5 then |
SetUpContainer() |
f:Hide() |
end |
end)]] |
WFContainer:SetScript("OnEvent", function() |
OTFContainer:RegisterEvent("PLAYER_ENTERING_WORLD") |
OTFContainer:SetScript("OnEvent", function() |
Initialize() |
SetUpContainer() --see if we can get away with this here now |
--f:Show() |
SetUpContainer() |
end) |
<Bindings> |
<Binding name="WFWWCOLLAPSE" > |
if ObjectiveTrackerFrame.collapsed then |
OTFContainer.ExpandObjectiveTracker() |
else |
OTFContainer.CollapseObjectiveTracker() |
end |
</Binding> |
</Bindings> |