Libraries update

This commit is contained in:
Tercio Jose
2023-03-19 20:06:58 -03:00
parent d0ccba9e03
commit 33b0dd0138
7 changed files with 169 additions and 64 deletions
+43 -47
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 16
local version = 17
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -71,19 +71,6 @@ function DF:CreateCoolTip()
gameCooltip.LanguageEditBox:ClearFocus()
gameCooltip.LanguageEditBox:SetAutoFocus(false)
function gameCooltip.CheckNeedNewFont(text)
--local file = gameCooltip.LanguageEditBox:GetFont()
--print("1", file, text)
--gameCooltip.LanguageEditBox:SetText("Цены аукциона")
--local file2 = gameCooltip.LanguageEditBox:GetFont()
--print("2", file2)
--gameCooltip.LanguageEditBox:ClearFocus()
--if (file ~= file2) then
-- gameCooltip:SetOption("TextFont", file2)
--end
end
--containers
gameCooltip.LeftTextTable = {}
gameCooltip.LeftTextTableSub = {}
@@ -172,6 +159,8 @@ function DF:CreateCoolTip()
["SparkColor"] = true,
["SparkPositionXOffset"] = true,
["SparkPositionYOffset"] = true,
["NoLanguageDetection"] = true,
}
gameCooltip.AliasList = {
@@ -602,7 +591,7 @@ function DF:CreateCoolTip()
statusbar.rightText = statusbar:CreateFontString("$parent_TextRight", "overlay", "GameFontNormal")
statusbar.rightText:SetJustifyH("RIGHT")
statusbar.rightText:SetPoint("RIGHT", statusbar.rightIcon, "LEFT", -3, 0)
DF:SetFontSize(statusbar.leftText, 10)
DF:SetFontSize(statusbar.rightText, 10)
--background status bar
self.statusbar2 = CreateFrame("StatusBar", "$Parent_StatusBarBackground", self)
@@ -940,19 +929,20 @@ function DF:CreateCoolTip()
--set text
if (leftTextSettings) then
--font settings
local languageId = DF.Language.DetectLanguageId(leftTextSettings[1])
if (languageId ~= menuButton.leftText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.leftText, newFont)
menuButton.leftText.languageId = languageId
--font language detection, can perform the detection if the font haven't been set by the user (usually by the options table)
if (not gameCooltip.OptionsTable.NoLanguageDetection and not gameCooltip.OptionsTable.TextFont) then
local languageId = DF.Language.DetectLanguageId(leftTextSettings[1])
if (languageId ~= menuButton.leftText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.leftText, newFont)
menuButton.leftText.languageId = languageId
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.leftText.requiredFont = newFont
gameCooltip.OptionsTable.TextFont = newFont
else
menuButton.leftText.requiredFont = nil
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.leftText.requiredFont = newFont
else
menuButton.leftText.requiredFont = nil
end
end
end
@@ -987,7 +977,11 @@ function DF:CreateCoolTip()
menuButton.leftText:SetHeight(0)
end
if (gameCooltip.OptionsTable.TextFont and not leftTextSettings[7]) then --font
if (menuButton.leftText.requiredFont) then --the language detector require this font to be used
local _, size, flags = menuButton.leftText:GetFont()
menuButton.leftText:SetFont(menuButton.leftText.requiredFont, size, flags)
elseif (gameCooltip.OptionsTable.TextFont and not leftTextSettings[7]) then --font
if (_G[gameCooltip.OptionsTable.TextFont]) then
menuButton.leftText:SetFontObject(_G.GameFontRed or gameCooltip.OptionsTable.TextFont)
else
@@ -995,7 +989,7 @@ function DF:CreateCoolTip()
local _, size, flags = menuButton.leftText:GetFont()
flags = leftTextSettings[8] or gameCooltip.OptionsTable.TextShadow or nil
size = leftTextSettings[6] or gameCooltip.OptionsTable.TextSize or size
menuButton.leftText:SetFont(menuButton.leftText.requiredFont or font, size, flags)
menuButton.leftText:SetFont(font, size, flags)
end
--font settings
@@ -1026,18 +1020,20 @@ function DF:CreateCoolTip()
end
if (rightTextSettings) then
local languageId = DF.Language.DetectLanguageId(rightTextSettings[1])
if (languageId ~= menuButton.rightText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.rightText, newFont)
menuButton.rightText.languageId = languageId
--font language detection, can perform the detection if the font haven't been set by the user (usually by the options table)
if (not gameCooltip.OptionsTable.NoLanguageDetection and not gameCooltip.OptionsTable.TextFont) then
local languageId = DF.Language.DetectLanguageId(rightTextSettings[1])
if (languageId ~= menuButton.rightText.languageId) then
local newFont = DF.Language.GetFontForLanguageID(languageId)
DF:SetFontFace(menuButton.rightText, newFont)
menuButton.rightText.languageId = languageId
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.rightText.requiredFont = newFont
gameCooltip.OptionsTable.TextFont = newFont
else
menuButton.rightText.requiredFont = nil
local bIsLatinAlphabet = DF:IsLatinLanguage(languageId)
if (not bIsLatinAlphabet) then
menuButton.rightText.requiredFont = newFont
else
menuButton.rightText.requiredFont = nil
end
end
end
@@ -1069,7 +1065,11 @@ function DF:CreateCoolTip()
menuButton.rightText:SetWidth(0)
end
if (gameCooltip.OptionsTable.TextFont and not rightTextSettings[7]) then
if (menuButton.rightText.requiredFont) then --the language detector require this font to be used
local _, size, flags = menuButton.rightText:GetFont()
menuButton.rightText:SetFont(menuButton.rightText.requiredFont, size, flags)
elseif (gameCooltip.OptionsTable.TextFont and not rightTextSettings[7]) then
if (_G[gameCooltip.OptionsTable.TextFont]) then
menuButton.rightText:SetFontObject(gameCooltip.OptionsTable.TextFont)
else
@@ -1077,7 +1077,7 @@ function DF:CreateCoolTip()
local _, fontSize, fontFlags = menuButton.rightText:GetFont()
fontFlags = rightTextSettings[8] or gameCooltip.OptionsTable.TextShadow or nil
fontSize = rightTextSettings[6] or gameCooltip.OptionsTable.TextSize or fontSize
menuButton.rightText:SetFont(menuButton.leftText.requiredFont or fontFace, fontSize, fontFlags)
menuButton.rightText:SetFont(fontFace, fontSize, fontFlags)
end
elseif (rightTextSettings[7]) then
@@ -3132,8 +3132,6 @@ function DF:CreateCoolTip()
end
end
gameCooltip.CheckNeedNewFont(leftText)
local rightTextType = type(rightText)
if (rightTextType ~= "string") then
if (rightTextType == "number") then
@@ -3143,8 +3141,6 @@ function DF:CreateCoolTip()
end
end
gameCooltip.CheckNeedNewFont(rightText)
if (type(ColorR1) ~= "number") then
ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2
if (type(ColorR1) == "boolean" or not ColorR1) then
@@ -3602,7 +3598,7 @@ function DF:CreateCoolTip()
end
gameCooltip:SetOption("StatusBarTexture", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]])
self:SetOption("TextFont", DF:GetBestFontForLanguage())
--self:SetOption("TextFont", DF.Language.GetFontForLanguageID(GetLocale()))
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 11)
self:SetOption("ButtonsYMod", -4)