Fixed: report window send button, tooltip showing the player's death

This commit is contained in:
Tercio Jose
2022-10-06 16:24:29 -03:00
parent 1daab21a63
commit ea9caa1f40
12 changed files with 2376 additions and 2903 deletions
+41 -34
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 3
local version = 4
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -145,10 +145,30 @@ function DF:CreateCoolTip()
}
gameCooltip.AliasList = {
["VerticalOffset"] = "ButtonsYMod",
["VerticalPadding"] = "YSpacingMod",
--set the height of each line, options 'IgnoreButtonAutoHeight' and 'AlignAsBlizzTooltip' must be false
["LineHeightSizeOffset"] = "ButtonHeightMod",
["LineHeightSizeOffsetSub"] = "ButtonHeightModSub",
["FrameHeightSizeOffset"] = "HeighMod",
["FrameHeightSizeOffsetSub"] = "HeighModSub",
--space between the tooltip's left side and the start of the line
["LeftPadding"] = "LeftBorderSize",
--space between the tooltip's right side and the end of the line
["RightPadding"] = "RightBorderSize",
--space between each line, positive values make the lines be closer
["LinePadding"] = "YSpacingMod",
["VerticalPadding"] = "YSpacingMod",
["LinePaddingSub"] = "YSpacingModSub",
["VerticalPaddingSub"] = "YSpacingModSub",
--move each line in the Y axis (vertical offsett)
["LineYOffset"] = "ButtonsYMod",
["VerticalOffset"] = "ButtonsYMod",
["LineYOffsetSub"] = "ButtonsYModSub",
["VerticalOffsetSub"] = "ButtonsYModSub",
}
gameCooltip.OptionsTable = {}
@@ -1475,8 +1495,8 @@ function DF:CreateCoolTip()
frame1.w = gameCooltip.OptionsTable.FixedWidth or 0
frame1.hHeight = 0
frame2.hHeight = 0
gameCooltip.active = true
for i = 1, gameCooltip.Indexes do
local button = frame1.Lines[i]
if (not button) then
@@ -1485,10 +1505,11 @@ function DF:CreateCoolTip()
button.index = i
--basic stuff
button:Show()
button.background:Hide()
button:SetHeight(gameCooltip.OptionsTable.ButtonHeightMod or gameCooltip.default_height)
--clear registered click buttons
button:RegisterForClicks()
--setup texts and icons
@@ -1510,7 +1531,7 @@ function DF:CreateCoolTip()
--normalize height of all rows
local heightValue = -6 + spacing + (gameCooltip.OptionsTable.ButtonsYMod or 0)
for i = 1, gameCooltip.Indexes do
for i = 1, gameCooltip.Indexes do
local menuButton = frame1.Lines[i]
menuButton:ClearAllPoints()
@@ -1528,19 +1549,17 @@ function DF:CreateCoolTip()
local height = max(2, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), gameCooltip.OptionsTable.AlignAsBlizzTooltipForceHeight or 2)
menuButton:SetHeight(height)
menuButton:SetPoint("top", frame1, "top", 0, heightValue)
heightValue = heightValue + ( height * -1)
heightValue = heightValue + (height * -1)
elseif (gameCooltip.OptionsTable.IgnoreButtonAutoHeight) then
local height = max(menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight())
menuButton:SetHeight(height)
menuButton:SetPoint("top", frame1, "top", 0, heightValue)
heightValue = heightValue + ( height * -1) + spacing + (gameCooltip.OptionsTable.ButtonsYMod or 0)
heightValue = heightValue + (height * -1) + spacing + (gameCooltip.OptionsTable.ButtonsYMod or 0)
else
menuButton:SetHeight(frame1.hHeight + (gameCooltip.OptionsTable.ButtonHeightMod or 0))
menuButton:SetPoint("top", frame1, "top", 0, ( ( (i-1) * frame1.hHeight) * -1) - 6 + (gameCooltip.OptionsTable.ButtonsYMod or 0) + spacing)
menuButton:SetPoint("top", frame1, "top", 0, (((i-1) * frame1.hHeight) * -1) - 6 + (gameCooltip.OptionsTable.ButtonsYMod or 0) + spacing)
end
if (gameCooltip.OptionsTable.YSpacingMod and not gameCooltip.OptionsTable.IgnoreButtonAutoHeight) then
@@ -1553,8 +1572,8 @@ function DF:CreateCoolTip()
if (not gameCooltip.OptionsTable.FixedWidth) then
if (gameCooltip.Type == 2) then --with bars
if (gameCooltip.OptionsTable.MinWidth) then
local w = frame1.w + 34
PixelUtil.SetWidth(frame1, math.max(w, gameCooltip.OptionsTable.MinWidth))
local width = frame1.w + 34
PixelUtil.SetWidth(frame1, math.max(width, gameCooltip.OptionsTable.MinWidth))
else
PixelUtil.SetWidth(frame1, frame1.w + 34)
end
@@ -1585,7 +1604,7 @@ function DF:CreateCoolTip()
PixelUtil.SetHeight(frame1, (heightValue + spacing) * -1)
else
PixelUtil.SetHeight(frame1, max( (frame1.hHeight * gameCooltip.Indexes) + 8 + ((gameCooltip.OptionsTable.ButtonsYMod or 0)*-1), 22 ))
PixelUtil.SetHeight(frame1, max((frame1.hHeight * gameCooltip.Indexes) + 8 + ((gameCooltip.OptionsTable.ButtonsYMod or 0) * -1), 22))
end
end
@@ -3136,39 +3155,27 @@ function DF:CreateCoolTip()
self:Reset(true)
end
gameCooltip:SetOption("StatusBarTexture", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]])
self:SetOption("TextFont", DF:GetBestFontForLanguage())
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 11)
self:SetOption("ButtonsYMod", -4)
self:SetOption("YSpacingMod", -4)
self:SetOption("IgnoreButtonAutoHeight", true)
if (presetId == 1) then
self:SetOption("TextFont", DF:GetBestFontForLanguage())
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 12)
self:SetOption("ButtonsYMod", -4)
self:SetOption("YSpacingMod", -4)
self:SetOption("IgnoreButtonAutoHeight", true)
self:SetColor(1, 0.5, 0.5, 0.5, 0.5)
elseif (presetId == 2) then --used by most of the widgets
self:SetOption("TextFont", DF:GetBestFontForLanguage())
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 12)
self:SetOption("FixedWidth", 220)
self:SetOption("ButtonsYMod", -4)
self:SetOption("YSpacingMod", -4)
self:SetOption("IgnoreButtonAutoHeight", true)
self:SetColor(1, defaultBackdropColor)
self:SetColor(2, defaultBackdropColor)
self:SetBackdrop(1, defaultBackdrop, defaultBackdropColor, defaultBackdropBorderColor)
self:SetBackdrop(2, defaultBackdrop, defaultBackdropColor, defaultBackdropBorderColor)
elseif (presetId == 3) then --default used when Cooltip:Reset() is called
self:SetOption("TextFont", DF:GetBestFontForLanguage())
self:SetOption("TextColor", "orange")
self:SetOption("TextSize", 12)
self:SetOption("ButtonsYMod", -4)
self:SetOption("YSpacingMod", -4)
self:SetOption("IgnoreButtonAutoHeight", true)
self:SetColor(1, defaultBackdropColor)
self:SetColor(2, defaultBackdropColor)
self:SetBackdrop(1, defaultBackdrop, defaultBackdropColor, defaultBackdropBorderColor)
self:SetBackdrop(2, defaultBackdrop, defaultBackdropColor, defaultBackdropBorderColor)
end