changeset 25:6bb668a41455

- framework update.
author Tercio
date Thu, 08 Oct 2015 11:52:43 -0300
parents 7a285d98b95f
children e16b1fc13935
files Hansgar_And_Franzok_Assist.lua Libs/DF/fw.lua Libs/DF/normal_bar.lua Libs/DF/slider.lua
diffstat 4 files changed, 63 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua	Mon Sep 14 17:10:38 2015 -0300
+++ b/Hansgar_And_Franzok_Assist.lua	Thu Oct 08 11:52:43 2015 -0300
@@ -19,7 +19,7 @@
 --local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent)
 local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz", "Hansgar_And_Franzok_Assist", nil, "top", true)
 f:SetFrameStrata ("DIALOG")
-f.version = "v0.15g"
+f.version = "v0.15h"
 
 f.Close:SetScript ("OnClick", function (self)
 	if (f.StampersPhase) then
--- a/Libs/DF/fw.lua	Mon Sep 14 17:10:38 2015 -0300
+++ b/Libs/DF/fw.lua	Thu Oct 08 11:52:43 2015 -0300
@@ -1,5 +1,6 @@
 
-local major, minor = "DetailsFramework-1.0", 9
+local dversion = 10
+local major, minor = "DetailsFramework-1.0", dversion
 local DF, oldminor = LibStub:NewLibrary (major, minor)
 
 if (not DF) then
@@ -8,6 +9,7 @@
 end
 
 DetailsFrameworkCanLoad = true
+local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
 
 local _type = type
 local _unpack = unpack
@@ -23,6 +25,11 @@
 DF.SliderCounter = 1
 DF.SplitBarCounter = 1
 
+DF.FrameWorkVersion = tostring (dversion)
+function DF:PrintVersion()
+	print ("Details! Framework Version:", DF.FrameWorkVersion)
+end
+
 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF)
 
 do
@@ -188,6 +195,11 @@
 	fontString:SetFont (fonte, max (...), flags)
 end
 function DF:SetFontFace (fontString, fontface)
+	local font = SharedMedia:Fetch ("font", fontface, true)
+	if (font) then
+		fontface = font
+	end
+
 	local _, size, flags = fontString:GetFont()
 	fontString:SetFont (fontface, size, flags)
 end
@@ -540,7 +552,11 @@
 	local tn = tonumber
 	function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
 		if (_type (_arg1) == "table") then
-			_arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
+			if (not _arg1[1] and _arg1.r) then
+				_arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
+			else
+				_arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
+			end
 		
 		elseif (_type (_arg1) == "string") then
 		
--- a/Libs/DF/normal_bar.lua	Mon Sep 14 17:10:38 2015 -0300
+++ b/Libs/DF/normal_bar.lua	Thu Oct 08 11:52:43 2015 -0300
@@ -197,6 +197,9 @@
 		_object.statusbar:SetStatusBarColor (_value1, _value2, _value3, _value4)
 		_object._texture.original_colors = {_value1, _value2, _value3, _value4}
 		_object.timer_texture:SetVertexColor (_value1, _value2, _value3, _value4)
+		
+		_object.timer_textureR:SetVertexColor (_value1, _value2, _value3, _value4)
+
 		return _object._texture:SetVertexColor (_value1, _value2, _value3, _value4)
 	end
 	--> icon
@@ -218,9 +221,11 @@
 			local _value1, _value2 = _unpack (_value)
 			_object._texture:SetTexture (_value1)
 			_object.timer_texture:SetTexture (_value1)
+			_object.timer_textureR:SetTexture (_value1)
 			if (_value2) then
 				_object._texture:SetTexCoord (_unpack (_value2))
 				_object.timer_texture:SetTexCoord (_unpack (_value2))
+				_object.timer_textureR:SetTexCoord (_unpack (_value2))
 			end
 		else
 			if (_value:find ("\\")) then
@@ -230,9 +235,11 @@
 				if (file) then
 					_object._texture:SetTexture (file)
 					_object.timer_texture:SetTexture (file)
+					_object.timer_textureR:SetTexture (file)
 				else
 					_object._texture:SetTexture (_value)
 					_object.timer_texture:SetTexture (_value)
+					_object.timer_textureR:SetTexture (_value)
 				end
 			end
 		end
@@ -521,6 +528,24 @@
 		self.timer = false
 	end
 
+	function BarMetaFunctions:CancelTimerBar (no_timer_end)
+		if (not self.HasTimer) then
+			return
+		end
+		if (self.TimerScheduled) then
+			DF:CancelTimer (self.TimerScheduled)
+			self.TimerScheduled = nil
+		else
+			if (self.statusbar:GetScript ("OnUpdate")) then
+				self.statusbar:SetScript ("OnUpdate", nil)
+			end
+		end
+		self.righttext = ""
+		if (not no_timer_end) then
+			self:OnTimerEnd()
+		end
+	end
+
 	local OnUpdate = function (self, elapsed)
 		--> percent of elapsed
 		local pct = abs (self.end_timer - GetTime() - self.tempo) / self.tempo
@@ -541,23 +566,24 @@
 		if (pct >= 1) then
 			self.righttext:SetText ("")
 			self:SetScript ("OnUpdate", nil)
+			self.MyObject.HasTimer = nil
 			self.MyObject:OnTimerEnd()
 		end
 	end
 	
-	function BarMetaFunctions:SetTimer (tempo)
-		
-		-- o que é inverso
-			-- barra cheia 
-			-- barra vazia
-		-- o que é left to right
-			-- barra que faz da direita pra esquerda
-			-- contrário
-		
-		self.statusbar.tempo = tempo
-		self.statusbar.remaining = tempo
+	function BarMetaFunctions:SetTimer (tempo, end_at)
+
+		if (end_at) then
+			self.statusbar.tempo = end_at - tempo
+			self.statusbar.remaining = end_at - GetTime()
+			self.statusbar.end_timer = end_at
+		else
+			self.statusbar.tempo = tempo
+			self.statusbar.remaining = tempo
+			self.statusbar.end_timer = GetTime() + tempo
+		end
+
 		self.statusbar.total_size = self.statusbar:GetWidth()
-		self.statusbar.end_timer = GetTime() + tempo
 		self.statusbar.inverse = self.BarIsInverse
 		
 		self (0)
@@ -590,10 +616,12 @@
 		
 		self.timer = true
 		
-		DF:ScheduleTimer ("StartTimeBarAnimation", 0.1, self)
+		self.HasTimer = true
+		self.TimerScheduled = DF:ScheduleTimer ("StartTimeBarAnimation", 0.1, self)
 	end
 	
 	function DF:StartTimeBarAnimation (timebar)
+		timebar.TimerScheduled = nil
 		timebar.statusbar:SetScript ("OnUpdate", OnUpdate)
 	end
 	
@@ -716,4 +744,4 @@
 		end
 		
 	return BarObject
-end
+end --endd
--- a/Libs/DF/slider.lua	Mon Sep 14 17:10:38 2015 -0300
+++ b/Libs/DF/slider.lua	Thu Oct 08 11:52:43 2015 -0300
@@ -377,10 +377,8 @@
 			slider:SetBackdropBorderColor (unpack (slider.MyObject.onleave_backdrop_border_color))
 		end
 	
-		if (slider.MyObject.have_tooltip) then 
-			GameCooltip2:ShowMe (false)
-		end
-		
+		GameCooltip2:ShowMe (false)
+
 	end