changeset 22:3596dadf9a90 v8.1.0.022

- ToC and Libraries update.
author Tercioo
date Mon, 31 Dec 2018 11:30:31 -0200
parents f29a995e98e3
children e15817422160
files HotCorners.toc Libs/AceTimer-3.0/AceTimer-3.0.xml Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua Libs/LibSharedMedia-3.0/lib.xml Libs/LibStub/LibStub.lua Libs/LibStub/LibStub.toc
diffstat 9 files changed, 233 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/HotCorners.toc	Fri Jul 20 19:13:22 2018 -0300
+++ b/HotCorners.toc	Mon Dec 31 11:30:31 2018 -0200
@@ -1,4 +1,4 @@
-## Interface: 80000
+## Interface: 80100
 ## Title: Hot Corners
 ## Notes: Adds a bar over the top left side.
 ## SavedVariables: HotCornersDB
--- a/Libs/AceTimer-3.0/AceTimer-3.0.xml	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/AceTimer-3.0/AceTimer-3.0.xml	Mon Dec 31 11:30:31 2018 -0200
@@ -1,4 +1,4 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
 ..\FrameXML\UI.xsd">
 	<Script file="AceTimer-3.0.lua"/>
-</Ui>
+</Ui>
\ No newline at end of file
--- a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua	Mon Dec 31 11:30:31 2018 -0200
@@ -1,5 +1,5 @@
---[[ $Id: CallbackHandler-1.0.lua 1131 2015-06-04 07:29:24Z nevcairiel $ ]]
-local MAJOR, MINOR = "CallbackHandler-1.0", 6
+--[[ $Id: CallbackHandler-1.0.lua 22 2018-07-21 14:17:22Z nevcairiel $ ]]
+local MAJOR, MINOR = "CallbackHandler-1.0", 7
 local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
 
 if not CallbackHandler then return end -- No upgrade needed
@@ -22,41 +22,15 @@
 	return geterrorhandler()(err)
 end
 
-local function CreateDispatcher(argCount)
-	local code = [[
-	local next, xpcall, eh = ...
-
-	local method, ARGS
-	local function call() method(ARGS) end
-
-	local function dispatch(handlers, ...)
-		local index
-		index, method = next(handlers)
-		if not method then return end
-		local OLD_ARGS = ARGS
-		ARGS = ...
-		repeat
-			xpcall(call, eh)
-			index, method = next(handlers, index)
-		until not method
-		ARGS = OLD_ARGS
-	end
-
-	return dispatch
-	]]
-
-	local ARGS, OLD_ARGS = {}, {}
-	for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
-	code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", "))
-	return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
+local function Dispatch(handlers, ...)
+	local index, method = next(handlers)
+	if not method then return end
+	repeat
+		xpcall(method, errorhandler, ...)
+		index, method = next(handlers, index)
+	until not method
 end
 
-local Dispatchers = setmetatable({}, {__index=function(self, argCount)
-	local dispatcher = CreateDispatcher(argCount)
-	rawset(self, argCount, dispatcher)
-	return dispatcher
-end})
-
 --------------------------------------------------------------------------
 -- CallbackHandler:New
 --
@@ -87,7 +61,7 @@
 		local oldrecurse = registry.recurse
 		registry.recurse = oldrecurse + 1
 
-		Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
+		Dispatch(events[eventname], eventname, ...)
 
 		registry.recurse = oldrecurse
 
--- a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml	Mon Dec 31 11:30:31 2018 -0200
@@ -1,4 +1,4 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
 ..\FrameXML\UI.xsd">
 	<Script file="CallbackHandler-1.0.lua"/>
-</Ui>
+</Ui>
\ No newline at end of file
--- a/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua	Mon Dec 31 11:30:31 2018 -0200
@@ -6,19 +6,21 @@
 --
 
 local DBICON10 = "LibDBIcon-1.0"
-local DBICON10_MINOR = 36 -- Bump on changes
+local DBICON10_MINOR = 43 -- Bump on changes
 if not LibStub then error(DBICON10 .. " requires LibStub.") end
 local ldb = LibStub("LibDataBroker-1.1", true)
 if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
 local lib = LibStub:NewLibrary(DBICON10, DBICON10_MINOR)
 if not lib then return end
 
-lib.disabled = lib.disabled or nil
 lib.objects = lib.objects or {}
 lib.callbackRegistered = lib.callbackRegistered or nil
 lib.callbacks = lib.callbacks or LibStub("CallbackHandler-1.0"):New(lib)
 lib.notCreated = lib.notCreated or {}
+lib.radius = lib.radius or 5
 lib.tooltip = lib.tooltip or CreateFrame("GameTooltip", "LibDBIconTooltip", UIParent, "GameTooltipTemplate")
+local next, Minimap = next, Minimap
+local isDraggingButton = false
 
 function lib:IconCallback(event, name, key, value)
 	if lib.objects[name] then
@@ -56,7 +58,15 @@
 end
 
 local function onEnter(self)
-	if self.isMoving then return end
+	if isDraggingButton then return end
+
+	for _, button in next, lib.objects do
+		if button.showOnMouseover then
+			button.fadeOut:Stop()
+			button:SetAlpha(1)
+		end
+	end
+
 	local obj = self.dataObject
 	if obj.OnTooltipShow then
 		lib.tooltip:SetOwner(self, "ANCHOR_NONE")
@@ -69,14 +79,25 @@
 end
 
 local function onLeave(self)
+	lib.tooltip:Hide()
+
+	if not isDraggingButton then
+		for _, button in next, lib.objects do
+			if button.showOnMouseover then
+				button.fadeOut:Play()
+			end
+		end
+	end
+
 	local obj = self.dataObject
-	lib.tooltip:Hide()
-	if obj.OnLeave then obj.OnLeave(self) end
+	if obj.OnLeave then
+		obj.OnLeave(self)
+	end
 end
 
 --------------------------------------------------------------------------------
 
-local onClick, onMouseUp, onMouseDown, onDragStart, onDragStop, updatePosition
+local onDragStart, updatePosition
 
 do
 	local minimapShapes = {
@@ -96,40 +117,60 @@
 		["TRICORNER-BOTTOMRIGHT"] = {true, true, true, false},
 	}
 
-	function updatePosition(button)
-		local angle = math.rad(button.db and button.db.minimapPos or button.minimapPos or 225)
-		local x, y, q = math.cos(angle), math.sin(angle), 1
+	local rad, cos, sin, sqrt, max, min = math.rad, math.cos, math.sin, math.sqrt, math.max, math.min
+	function updatePosition(button, position)
+		local angle = rad(position or 225)
+		local x, y, q = cos(angle), sin(angle), 1
 		if x < 0 then q = q + 1 end
 		if y > 0 then q = q + 2 end
 		local minimapShape = GetMinimapShape and GetMinimapShape() or "ROUND"
 		local quadTable = minimapShapes[minimapShape]
+		local w = (Minimap:GetWidth() / 2) + lib.radius
+		local h = (Minimap:GetHeight() / 2) + lib.radius
 		if quadTable[q] then
-			x, y = x*80, y*80
+			x, y = x*w, y*h
 		else
-			local diagRadius = 103.13708498985 --math.sqrt(2*(80)^2)-10
-			x = math.max(-80, math.min(x*diagRadius, 80))
-			y = math.max(-80, math.min(y*diagRadius, 80))
+			local diagRadiusW = sqrt(2*(w)^2)-10
+			local diagRadiusH = sqrt(2*(h)^2)-10
+			x = max(-w, min(x*diagRadiusW, w))
+			y = max(-h, min(y*diagRadiusH, h))
 		end
 		button:SetPoint("CENTER", Minimap, "CENTER", x, y)
 	end
 end
 
-function onClick(self, b) if self.dataObject.OnClick then self.dataObject.OnClick(self, b) end end
-function onMouseDown(self) self.isMouseDown = true; self.icon:UpdateCoord() end
-function onMouseUp(self) self.isMouseDown = false; self.icon:UpdateCoord() end
+local function onClick(self, b)
+	if self.dataObject.OnClick then
+		self.dataObject.OnClick(self, b)
+	end
+end
+
+local function onMouseDown(self)
+	self.isMouseDown = true
+	self.icon:UpdateCoord()
+end
+
+local function onMouseUp(self)
+	self.isMouseDown = false
+	self.icon:UpdateCoord()
+end
 
 do
+	local deg, atan2 = math.deg, math.atan2
 	local function onUpdate(self)
 		local mx, my = Minimap:GetCenter()
 		local px, py = GetCursorPosition()
 		local scale = Minimap:GetEffectiveScale()
 		px, py = px / scale, py / scale
+		local pos = 225
 		if self.db then
-			self.db.minimapPos = math.deg(math.atan2(py - my, px - mx)) % 360
+			pos = deg(atan2(py - my, px - mx)) % 360
+			self.db.minimapPos = pos
 		else
-			self.minimapPos = math.deg(math.atan2(py - my, px - mx)) % 360
+			pos = deg(atan2(py - my, px - mx)) % 360
+			self.minimapPos = pos
 		end
-		updatePosition(self)
+		updatePosition(self, pos)
 	end
 
 	function onDragStart(self)
@@ -137,17 +178,28 @@
 		self.isMouseDown = true
 		self.icon:UpdateCoord()
 		self:SetScript("OnUpdate", onUpdate)
-		self.isMoving = true
+		isDraggingButton = true
 		lib.tooltip:Hide()
+		for _, button in next, lib.objects do
+			if button.showOnMouseover then
+				button.fadeOut:Stop()
+				button:SetAlpha(1)
+			end
+		end
 	end
 end
 
-function onDragStop(self)
+local function onDragStop(self)
 	self:SetScript("OnUpdate", nil)
 	self.isMouseDown = false
 	self.icon:UpdateCoord()
 	self:UnlockHighlight()
-	self.isMoving = nil
+	isDraggingButton = false
+	for _, button in next, lib.objects do
+		if button.showOnMouseover then
+			button.fadeOut:Play()
+		end
+	end
 end
 
 local defaultCoords = {0, 1, 0, 1}
@@ -202,12 +254,24 @@
 	button:SetScript("OnMouseDown", onMouseDown)
 	button:SetScript("OnMouseUp", onMouseUp)
 
+	button.fadeOut = button:CreateAnimationGroup()
+	local animOut = button.fadeOut:CreateAnimation("Alpha")
+	animOut:SetOrder(1)
+	animOut:SetDuration(0.2)
+	animOut:SetFromAlpha(1)
+	animOut:SetToAlpha(0)
+	animOut:SetStartDelay(1)
+	button.fadeOut:SetToFinalAlpha(true)
+
 	lib.objects[name] = button
 
 	if lib.loggedIn then
-		updatePosition(button)
-		if not db or not db.hide then button:Show()
-		else button:Hide() end
+		updatePosition(button, db and db.minimapPos)
+		if not db or not db.hide then
+			button:Show()
+		else
+			button:Hide()
+		end
 	end
 	lib.callbacks:Fire("LibDBIcon_IconCreated", button, name) -- Fire 'Icon Created' callback
 end
@@ -221,20 +285,21 @@
 	end
 end
 
-lib.loggedIn = lib.loggedIn or false
 -- Wait a bit with the initial positioning to let any GetMinimapShape addons
 -- load up.
 if not lib.loggedIn then
 	local f = CreateFrame("Frame")
-	f:SetScript("OnEvent", function()
-		for _, object in pairs(lib.objects) do
-			updatePosition(object)
-			if not lib.disabled and (not object.db or not object.db.hide) then object:Show()
-			else object:Hide() end
+	f:SetScript("OnEvent", function(f)
+		for _, button in next, lib.objects do
+			updatePosition(button, button.db and button.db.minimapPos)
+			if not button.db or not button.db.hide then
+				button:Show()
+			else
+				button:Hide()
+			end
 		end
 		lib.loggedIn = true
 		f:SetScript("OnEvent", nil)
-		f = nil
 	end)
 	f:RegisterEvent("PLAYER_LOGIN")
 end
@@ -245,8 +310,8 @@
 
 function lib:Register(name, object, db)
 	if not object.icon then error("Can't register LDB objects without icons set!") end
-	if lib.objects[name] or lib.notCreated[name] then error("Already registered, nubcake.") end
-	if not lib.disabled and (not db or not db.hide) then
+	if lib.objects[name] or lib.notCreated[name] then error(DBICON10.. ": Object '".. name .."' is already registered.") end
+	if not db or not db.hide then
 		createButton(name, object, db)
 	else
 		lib.notCreated[name] = {object, db}
@@ -260,7 +325,9 @@
 		lib.objects[name]:SetScript("OnDragStop", nil)
 	end
 	local db = getDatabase(name)
-	if db then db.lock = true end
+	if db then
+		db.lock = true
+	end
 end
 
 function lib:Unlock(name)
@@ -270,28 +337,36 @@
 		lib.objects[name]:SetScript("OnDragStop", onDragStop)
 	end
 	local db = getDatabase(name)
-	if db then db.lock = nil end
+	if db then
+		db.lock = nil
+	end
 end
 
 function lib:Hide(name)
 	if not lib.objects[name] then return end
 	lib.objects[name]:Hide()
 end
+
 function lib:Show(name)
-	if lib.disabled then return end
 	check(name)
-	lib.objects[name]:Show()
-	updatePosition(lib.objects[name])
+	local button = lib.objects[name]
+	if button then
+		button:Show()
+		updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
+	end
 end
+
 function lib:IsRegistered(name)
 	return (lib.objects[name] or lib.notCreated[name]) and true or false
 end
+
 function lib:Refresh(name, db)
-	if lib.disabled then return end
 	check(name)
 	local button = lib.objects[name]
-	if db then button.db = db end
-	updatePosition(button)
+	if db then
+		button.db = db
+	end
+	updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
 	if not button.db or not button.db.hide then
 		button:Show()
 	else
@@ -305,30 +380,91 @@
 		button:SetScript("OnDragStop", nil)
 	end
 end
+
 function lib:GetMinimapButton(name)
 	return lib.objects[name]
 end
 
-function lib:EnableLibrary()
-	lib.disabled = nil
-	for name, object in pairs(lib.objects) do
-		if not object.db or not object.db.hide then
-			object:Show()
-			updatePosition(object)
+do
+	local function OnMinimapEnter()
+		if isDraggingButton then return end
+		for _, button in next, lib.objects do
+			if button.showOnMouseover then
+				button.fadeOut:Stop()
+				button:SetAlpha(1)
+			end
 		end
 	end
-	for name, data in pairs(lib.notCreated) do
-		if not data.db or not data.db.hide then
-			createButton(name, data[1], data[2])
-			lib.notCreated[name] = nil
+	local function OnMinimapLeave()
+		if isDraggingButton then return end
+		for _, button in next, lib.objects do
+			if button.showOnMouseover then
+				button.fadeOut:Play()
+			end
+		end
+	end
+	Minimap:HookScript("OnEnter", OnMinimapEnter)
+	Minimap:HookScript("OnLeave", OnMinimapLeave)
+
+	function lib:ShowOnEnter(name, value)
+		local button = lib.objects[name]
+		if button then
+			if value then
+				button.showOnMouseover = true
+				button.fadeOut:Stop()
+				button:SetAlpha(0)
+			else
+				button.showOnMouseover = false
+				button.fadeOut:Stop()
+				button:SetAlpha(1)
+			end
 		end
 	end
 end
 
-function lib:DisableLibrary()
-	lib.disabled = true
-	for name, object in pairs(lib.objects) do
-		object:Hide()
+function lib:GetButtonList()
+	local t = {}
+	for name in next, lib.objects do
+		t[#t+1] = name
+	end
+	return t
+end
+
+function lib:SetButtonRadius(radius)
+	if type(radius) == "number" then
+		lib.radius = radius
+		for _, button in next, lib.objects do
+			updatePosition(button, button.db and button.db.minimapPos or button.minimapPos)
+		end
 	end
 end
 
+function lib:SetButtonToPosition(button, position)
+	updatePosition(lib.objects[button] or button, position)
+end
+
+-- Upgrade!
+for name, button in next, lib.objects do
+	local db = getDatabase(name)
+	if not db or not db.lock then
+		button:SetScript("OnDragStart", onDragStart)
+		button:SetScript("OnDragStop", onDragStop)
+	end
+	button:SetScript("OnEnter", onEnter)
+	button:SetScript("OnLeave", onLeave)
+	button:SetScript("OnClick", onClick)
+	button:SetScript("OnMouseDown", onMouseDown)
+	button:SetScript("OnMouseUp", onMouseUp)
+
+	if not button.fadeOut then -- Upgrade to 39
+		button.fadeOut = button:CreateAnimationGroup()
+		local animOut = button.fadeOut:CreateAnimation("Alpha")
+		animOut:SetOrder(1)
+		animOut:SetDuration(0.2)
+		animOut:SetFromAlpha(1)
+		animOut:SetToAlpha(0)
+		animOut:SetStartDelay(1)
+		button.fadeOut:SetToFinalAlpha(true)
+	end
+end
+lib:SetButtonRadius(lib.radius) -- Upgrade to 40
--- a/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua	Mon Dec 31 11:30:31 2018 -0200
@@ -1,6 +1,6 @@
 --[[
 Name: LibSharedMedia-3.0
-Revision: $Revision: 91 $
+Revision: $Revision: 106 $
 Author: Elkano (elkano@gmx.de)
 Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
 Website: http://www.wowace.com/projects/libsharedmedia-3-0/
@@ -20,8 +20,6 @@
 local type		= _G.type
 
 local band			= _G.bit.band
-
-local table_insert	= _G.table.insert
 local table_sort	= _G.table.sort
 
 local locale = GetLocale()
--- a/Libs/LibSharedMedia-3.0/lib.xml	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/LibSharedMedia-3.0/lib.xml	Mon Dec 31 11:30:31 2018 -0200
@@ -1,4 +1,4 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
 ..\FrameXML\UI.xsd">
 	<Script file="LibSharedMedia-3.0.lua" />
-</Ui>
+</Ui>
\ No newline at end of file
--- a/Libs/LibStub/LibStub.lua	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/LibStub/LibStub.lua	Mon Dec 31 11:30:31 2018 -0200
@@ -1,13 +1,22 @@
--- LibStub is a simple versioning stub meant for use in Libraries.  http://www.wowace.com/wiki/LibStub for more info
--- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
+-- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $
+-- LibStub is a simple versioning stub meant for use in Libraries.  http://www.wowace.com/addons/libstub/ for more info
+-- LibStub is hereby placed in the Public Domain
+-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
 local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2  -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
 local LibStub = _G[LIBSTUB_MAJOR]
 
+-- Check to see is this version of the stub is obsolete
 if not LibStub or LibStub.minor < LIBSTUB_MINOR then
 	LibStub = LibStub or {libs = {}, minors = {} }
 	_G[LIBSTUB_MAJOR] = LibStub
 	LibStub.minor = LIBSTUB_MINOR
 	
+	-- LibStub:NewLibrary(major, minor)
+	-- major (string) - the major version of the library
+	-- minor (string or number ) - the minor version of the library
+	-- 
+	-- returns nil if a newer or same version of the lib is already present
+	-- returns empty library object or old library object if upgrade is needed
 	function LibStub:NewLibrary(major, minor)
 		assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
 		minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
@@ -18,6 +27,12 @@
 		return self.libs[major], oldminor
 	end
 	
+	-- LibStub:GetLibrary(major, [silent])
+	-- major (string) - the major version of the library
+	-- silent (boolean) - if true, library is optional, silently return nil if its not found
+	--
+	-- throws an error if the library can not be found (except silent is set)
+	-- returns the library object if found
 	function LibStub:GetLibrary(major, silent)
 		if not self.libs[major] and not silent then
 			error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
@@ -25,6 +40,12 @@
 		return self.libs[major], self.minors[major]
 	end
 	
-	function LibStub:IterateLibraries() return pairs(self.libs) end
+	-- LibStub:IterateLibraries()
+	-- 
+	-- Returns an iterator for the currently registered libraries
+	function LibStub:IterateLibraries() 
+		return pairs(self.libs) 
+	end
+	
 	setmetatable(LibStub, { __call = LibStub.GetLibrary })
 end
--- a/Libs/LibStub/LibStub.toc	Fri Jul 20 19:13:22 2018 -0300
+++ b/Libs/LibStub/LibStub.toc	Mon Dec 31 11:30:31 2018 -0200
@@ -1,13 +1,9 @@
-## Interface: 40200
+## Interface: 80000
 ## Title: Lib: LibStub
 ## Notes: Universal Library Stub
 ## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
 ## X-Website: http://www.wowace.com/addons/libstub/
 ## X-Category: Library
-## X-License: Public Domain	
-## X-Curse-Packaged-Version: r95
-## X-Curse-Project-Name: LibStub
-## X-Curse-Project-ID: libstub
-## X-Curse-Repository-ID: wow/libstub/mainline
+## X-License: Public Domain
 
 LibStub.lua