changeset 42:e0a8f43009ea

- toc and framework update.
author Tercio
date Tue, 25 Oct 2016 16:38:32 -0200
parents b740f601e824
children 2681843ada1c
files Hansgar_And_Franzok_Assist.toc Libs/DF/fw.lua Libs/DF/panel.lua
diffstat 3 files changed, 55 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.toc	Sat Sep 03 17:53:04 2016 -0300
+++ b/Hansgar_And_Franzok_Assist.toc	Tue Oct 25 16:38:32 2016 -0200
@@ -1,4 +1,4 @@
-## Interface: 70000
+## Interface: 70100
 ## Title: Hansgar And Franzok Assist
 ## Notes: Helps with Smart Stampers on Mythic during this encounter.
 ## SavedVariables: Hansgar_And_Franzok_DB
--- a/Libs/DF/fw.lua	Sat Sep 03 17:53:04 2016 -0300
+++ b/Libs/DF/fw.lua	Tue Oct 25 16:38:32 2016 -0200
@@ -1,5 +1,5 @@
 
-local dversion = 44
+local dversion = 48
 local major, minor = "DetailsFramework-1.0", dversion
 local DF, oldminor = LibStub:NewLibrary (major, minor)
 
@@ -115,6 +115,7 @@
 	"CreateAnimation",
 	"CreateScrollBox",
 	"CreateBorder",
+	"FormatNumber",
 }
 
 DF.table = {}
@@ -217,6 +218,43 @@
 	mmoc = {0, 0.7890625, 80/123, 123/128},
 }
 
+local symbol_1K, symbol_10K, symbol_1B
+if (GetLocale() == "koKR") then
+	symbol_1K, symbol_10K, symbol_1B = "천", "만", "억"
+elseif (GetLocale() == "zhCN") then
+	symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿"
+elseif (GetLocale() == "zhTW") then
+	symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億"
+end
+
+if (symbol_1K) then
+	function DF.FormatNumber (numero)
+		if (numero > 99999999) then
+			return format ("%.2f", numero/100000000) .. symbol_1B
+		elseif (numero > 999999) then
+			return format ("%.2f", numero/10000) .. symbol_10K
+		elseif (numero > 99999) then
+			return floor (numero/10000) .. symbol_10K
+		elseif (numero > 9999) then
+			return format ("%.1f", (numero/10000)) .. symbol_10K
+		elseif (numero > 999) then
+			return format ("%.1f", (numero/1000)) .. symbol_1K
+		end
+		return format ("%.1f", numero)
+	end
+else
+	function DF.FormatNumber (numero)
+		if (numero > 999999) then
+			return format ("%.2f", numero/1000000) .. "M"
+		elseif (numero > 99999) then
+			return floor (numero/1000) .. "K"
+		elseif (numero > 999) then
+			return format ("%.1f", (numero/1000)) .. "K"
+		end
+		return format ("%.1f", numero)
+	end
+end
+
 function DF:IntegerToTimer (value)
 	return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
 end
--- a/Libs/DF/panel.lua	Sat Sep 03 17:53:04 2016 -0300
+++ b/Libs/DF/panel.lua	Tue Oct 25 16:38:32 2016 -0200
@@ -582,6 +582,7 @@
 				tinsert (self._anchors, cur_width)
 				cur_width = cur_width + self._raw_rows [index].width + 1
 			end
+			
 			row:Show()
 
 			local type = row.type
@@ -597,6 +598,9 @@
 					tinsert (line.text_inuse, text)
 					text:SetPoint ("left", line, "left", self._anchors [#self._anchors], 0)
 					text:SetWidth (row.width)
+					
+					DF:SetFontSize (text, row.textsize or 10)
+					text:SetJustifyH (row.textalign or "left")
 				end
 			elseif (type == "entry") then
 				for i = 1, #self.scrollframe.lines do
@@ -692,12 +696,19 @@
 		else
 			raw.name = t.name
 			raw.hidden = t.hidden or false
+			raw.textsize = t.textsize
+			raw.textalign = t.textalign
 			
 			local widget = self.rows [i]
 			widget.name = t.name
+			widget.textsize = t.textsize
+			widget.textalign = t.textalign
 			widget.hidden = t.hidden or false
 			
 			widget.text:SetText (t.name)
+			DF:SetFontSize (widget.text, raw.textsize or 10)
+			widget.text:SetJustifyH (raw.textalign or "left")
+			
 		end
 	end
 	
@@ -908,6 +919,10 @@
 								fontstring:SetText (results [index])
 								fontstring.index = real_index
 								fontstring:Show()
+								
+								if (true) then
+									--print (t.hello)
+								end
 
 							elseif (t.type == "entry") then
 								local entrywidget = row.entry_inuse [entry]