comparison Libs/DF/fw.lua @ 25:6bb668a41455

- framework update.
author Tercio
date Thu, 08 Oct 2015 11:52:43 -0300
parents 7a285d98b95f
children e16b1fc13935
comparison
equal deleted inserted replaced
24:7a285d98b95f 25:6bb668a41455
1 1
2 local major, minor = "DetailsFramework-1.0", 9 2 local dversion = 10
3 local major, minor = "DetailsFramework-1.0", dversion
3 local DF, oldminor = LibStub:NewLibrary (major, minor) 4 local DF, oldminor = LibStub:NewLibrary (major, minor)
4 5
5 if (not DF) then 6 if (not DF) then
6 DetailsFrameworkCanLoad = false 7 DetailsFrameworkCanLoad = false
7 return 8 return
8 end 9 end
9 10
10 DetailsFrameworkCanLoad = true 11 DetailsFrameworkCanLoad = true
12 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
11 13
12 local _type = type 14 local _type = type
13 local _unpack = unpack 15 local _unpack = unpack
14 local _ 16 local _
15 local upper = string.upper 17 local upper = string.upper
20 DF.DropDownCounter = 1 22 DF.DropDownCounter = 1
21 DF.PanelCounter = 1 23 DF.PanelCounter = 1
22 DF.ButtonCounter = 1 24 DF.ButtonCounter = 1
23 DF.SliderCounter = 1 25 DF.SliderCounter = 1
24 DF.SplitBarCounter = 1 26 DF.SplitBarCounter = 1
27
28 DF.FrameWorkVersion = tostring (dversion)
29 function DF:PrintVersion()
30 print ("Details! Framework Version:", DF.FrameWorkVersion)
31 end
25 32
26 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF) 33 LibStub:GetLibrary("AceTimer-3.0"):Embed (DF)
27 34
28 do 35 do
29 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua") 36 local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua")
186 function DF:SetFontSize (fontString, ...) 193 function DF:SetFontSize (fontString, ...)
187 local fonte, _, flags = fontString:GetFont() 194 local fonte, _, flags = fontString:GetFont()
188 fontString:SetFont (fonte, max (...), flags) 195 fontString:SetFont (fonte, max (...), flags)
189 end 196 end
190 function DF:SetFontFace (fontString, fontface) 197 function DF:SetFontFace (fontString, fontface)
198 local font = SharedMedia:Fetch ("font", fontface, true)
199 if (font) then
200 fontface = font
201 end
202
191 local _, size, flags = fontString:GetFont() 203 local _, size, flags = fontString:GetFont()
192 fontString:SetFont (fontface, size, flags) 204 fontString:SetFont (fontface, size, flags)
193 end 205 end
194 function DF:SetFontColor (fontString, r, g, b, a) 206 function DF:SetFontColor (fontString, r, g, b, a)
195 r, g, b, a = DF:ParseColors (r, g, b, a) 207 r, g, b, a = DF:ParseColors (r, g, b, a)
538 end 550 end
539 551
540 local tn = tonumber 552 local tn = tonumber
541 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4) 553 function DF:ParseColors (_arg1, _arg2, _arg3, _arg4)
542 if (_type (_arg1) == "table") then 554 if (_type (_arg1) == "table") then
543 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1) 555 if (not _arg1[1] and _arg1.r) then
556 _arg1, _arg2, _arg3, _arg4 = _arg1.r, _arg1.g, _arg1.b, _arg1.a
557 else
558 _arg1, _arg2, _arg3, _arg4 = _unpack (_arg1)
559 end
544 560
545 elseif (_type (_arg1) == "string") then 561 elseif (_type (_arg1) == "string") then
546 562
547 if (string.find (_arg1, "#")) then 563 if (string.find (_arg1, "#")) then
548 _arg1 = _arg1:gsub ("#","") 564 _arg1 = _arg1:gsub ("#","")