From ca0775dcdab1801650aae41fb317e2301987c1d9 Mon Sep 17 00:00:00 2001 From: Tercioo Date: Wed, 21 Nov 2018 22:14:43 -0200 Subject: [PATCH] - Fixed window for report to Copy/Paste. - Removed Report History from the report window. - Fixed tooltip not hiding after clicking the report button. --- Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 15 +++++-- classes/classe_instancia.lua | 3 +- core/windows.lua | 1 + functions/link.lua | 1 + gumps/janela_principal.lua | 1 + gumps/janela_report.lua | 82 ++++++++++++++++++++++-------------- startup.lua | 3 ++ 8 files changed, 70 insertions(+), 38 deletions(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index b969596d..747bf468 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 121 +local dversion = 122 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index a4612db9..9fc3e572 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -6314,17 +6314,18 @@ DF.DataScrollFunctions = { line.Date = date line.Text = text + line.backdrop_color = self.options.backdrop_color or {.1, .1, .1, .3} + line.backdrop_color_highlight = self.options.backdrop_color_highlight or {.3, .3, .3, .5} + return line end, LineOnEnter = function (self) - local parent = self:GetParent() - self:SetBackdropColor (unpack (parent.options.backdrop_color_highlight)) + self:SetBackdropColor (unpack (self.backdrop_color_highlight)) end, LineOnLeave = function (self) - local parent = self:GetParent() - self:SetBackdropColor (unpack (parent.options.backdrop_color)) + self:SetBackdropColor (unpack (self.backdrop_color)) end, OnClick = function (self) @@ -6341,6 +6342,10 @@ DF.DataScrollFunctions = { else line.Text.text = data [2] or "" end + + if (line:GetParent().OnUpdateLineHook) then + DF:CoreDispatch ((line:GetName() or "ScrollBoxDataScrollUpdateLineHook") .. ":UpdateLineHook()", line:GetParent().OnUpdateLineHook, line, lineIndex, data) + end end, } @@ -6483,6 +6488,8 @@ function DF:CreateNewsFrame (parent, name, options, newsTable, db) newsScroll:SetPoint ("topleft", f, "topleft", 5, -30) end + f.NewsScroll = newsScroll + return f end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 79c6dc25..ff437bb9 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -3415,7 +3415,8 @@ function _detalhes:envia_relatorio (linhas, custom) _detalhes:DelayUpdateReportWindowRecentlyReported() if (_detalhes.report_where == "COPY") then - return _detalhes:SendReportTextWindow (linhas) + _detalhes:SendReportTextWindow (linhas) + return end local to_who = _detalhes.report_where diff --git a/core/windows.lua b/core/windows.lua index 93d9414d..fd9c5d8a 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -7046,3 +7046,4 @@ function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText) DetailsExportWindow.ImportEditor.editbox:HighlightText (0) end) end + diff --git a/functions/link.lua b/functions/link.lua index 0ca8146e..254d97da 100644 --- a/functions/link.lua +++ b/functions/link.lua @@ -4626,6 +4626,7 @@ function _detalhes.OpenDetailsDeathRecap (segment, RecapID, fromChat) end spellName = spellName:gsub (L["STRING_DOT"], "") + spellName = spellName:gsub ("[*] ", "") --print ("link.lua", L["STRING_DOT"], spellName, spellName:find (L["STRING_DOT"]), spellName:gsub (L["STRING_DOT"], "")) source = source or "" diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 462bde12..a7ba6af3 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -9197,6 +9197,7 @@ function gump:CriaCabecalho (baseframe, instancia) --> REPORTAR ~report ---------------------------------------------------------------------------------------------------------------------------------------------------- local report_func = function() instancia:Reportar ("INSTANCE" .. instancia.meu_id) + GameCooltip2:Hide() end baseframe.cabecalho.report = gump:NewButton (baseframe, nil, "DetailsReportButton"..instancia.meu_id, nil, 8, 16, report_func) baseframe.cabecalho.report:SetFrameLevel (baseframe.UPFrame:GetFrameLevel()+1) diff --git a/gumps/janela_report.lua b/gumps/janela_report.lua index 29c184be..8acead9e 100644 --- a/gumps/janela_report.lua +++ b/gumps/janela_report.lua @@ -138,35 +138,29 @@ local _UIParent = UIParent --> wow api locals function _detalhes:SendReportTextWindow (lines) if (not _detalhes.copypasteframe) then - _detalhes.copypasteframe = CreateFrame ("editbox", "DetailsCopyPasteFrame2", UIParent) + _detalhes.copypasteframe = CreateFrame ("frame", "DetailsCopyPasteFrame2", UIParent) _detalhes.copypasteframe:SetFrameStrata ("TOOLTIP") _detalhes.copypasteframe:SetPoint ("CENTER", UIParent, "CENTER", 0, 50) tinsert (UISpecialFrames, "DetailsCopyPasteFrame2") _detalhes.copypasteframe:SetSize (400, 400) - _detalhes.copypasteframe:SetBackdrop ({bgFile = "Interface\\ACHIEVEMENTFRAME\\UI-Achievement-Parchment-Horizontal-Desaturated", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 8, - insets = {left = 0, right = 0, top = 0, bottom = 0},}) - _detalhes.copypasteframe:SetBackdropColor (0, 0, 0, 0.9) - _detalhes.copypasteframe:SetAutoFocus (false) - _detalhes.copypasteframe:SetMultiLine (true) - _detalhes.copypasteframe:SetFontObject ("GameFontHighlightSmall") _detalhes.copypasteframe:Hide() - local title = _detalhes.copypasteframe:CreateFontString (nil, "overlay", "GameFontNormal") - title:SetPoint ("bottomleft", _detalhes.copypasteframe, "topleft", 2, 2) - title:SetText ("Press Ctrl + C and paste wherever you want, press any key to close.") - title:SetJustifyH ("left") + DetailsFramework:ApplyStandardBackdrop (_detalhes.copypasteframe) + DetailsFramework:CreateTitleBar (_detalhes.copypasteframe, "Export Text") - local texture = _detalhes.copypasteframe:CreateTexture (nil, "overlay") - texture:SetTexture (0, 0, 0, 1) - texture:SetSize (400, 25) - texture:SetPoint ("bottomleft", _detalhes.copypasteframe, "topleft") + local editBox = CreateFrame ("editbox", nil, _detalhes.copypasteframe) + editBox:SetPoint ("topleft", _detalhes.copypasteframe, "topleft", 2, -26) + editBox:SetPoint ("bottomright", _detalhes.copypasteframe, "bottomright", -2, 2) + editBox:SetAutoFocus (false) + editBox:SetMultiLine (true) + editBox:SetFontObject ("GameFontHighlightSmall") - _detalhes.copypasteframe:SetScript ("OnEditFocusGained", function() _detalhes.copypasteframe:HighlightText() end) - _detalhes.copypasteframe:SetScript ("OnEditFocusLost", function() _detalhes.copypasteframe:Hide() end) - _detalhes.copypasteframe:SetScript ("OnEscapePressed", function() _detalhes.copypasteframe:SetFocus (false); _detalhes.copypasteframe:Hide() end) - _detalhes.copypasteframe:SetScript ("OnChar", function() _detalhes.copypasteframe:SetFocus (false); _detalhes.copypasteframe:Hide() end) + editBox:SetScript ("OnEditFocusGained", function() editBox:HighlightText() end) + editBox:SetScript ("OnEditFocusLost", function() _detalhes.copypasteframe:Hide() end) + editBox:SetScript ("OnEscapePressed", function() editBox:SetFocus (false); _detalhes.copypasteframe:Hide() end) + editBox:SetScript ("OnChar", function() editBox:SetFocus (false); _detalhes.copypasteframe:Hide() end) + + _detalhes.copypasteframe.EditBox = editBox end local s = "" @@ -175,10 +169,9 @@ local _UIParent = UIParent --> wow api locals end _detalhes.copypasteframe:Show() - _detalhes.copypasteframe:SetText (s) - _detalhes.copypasteframe:HighlightText() - _detalhes.copypasteframe:SetFocus (true) - + _detalhes.copypasteframe.EditBox:SetText (s) + _detalhes.copypasteframe.EditBox:HighlightText() + _detalhes.copypasteframe.EditBox:SetFocus (true) end @@ -186,6 +179,8 @@ local _UIParent = UIParent --> wow api locals function _detalhes:Reportar (param2, options, arg3, id) + GameCooltip2:Hide() + if (not _detalhes.janela_report) then _detalhes.janela_report = gump:CriaJanelaReport() end @@ -609,6 +604,8 @@ local function cria_drop_down (este_gump) local elvui_skin = function() local window = DetailsReportWindow + + local anchorX = 10 local b_onenter = function (self) self:SetBackdropColor (0.4, 0.4, 0.4, 0.6) @@ -651,7 +648,7 @@ local function cria_drop_down (este_gump) window.dropdown:ClearAllPoints() window.dropdown:SetWidth (155) - window.dropdown:SetPoint ("topleft", window, "topleft", 175, -30) + window.dropdown:SetPoint ("topleft", window, "topleft", anchorX, -30) window.dropdown:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile=true, tileSize = 64, insets = {left = 0, right = 0, top = 0, bottom = 0}}) window.dropdown:SetBackdropBorderColor (0, 0, 0, 0.5) @@ -700,7 +697,7 @@ local function cria_drop_down (este_gump) _G [reverse_checkbox:GetName().."Text"]:SetPoint ("left", reverse_checkbox, "right", 2, 0) window.enviar:ClearAllPoints() - window.enviar:SetPoint ("topleft", reverse_checkbox, "bottomleft", 0, -8) + window.enviar:SetPoint ("bottom", window, "bottom", 0, 10) window.enviar:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile=true, tileSize = 64, insets = {left = 0, right = 0, top = 0, bottom = 0}}) window.enviar:SetBackdropBorderColor (0, 0, 0, 0.5) @@ -709,8 +706,10 @@ local function cria_drop_down (este_gump) window.enviar.Middle:Hide() window.enviar.Right:Hide() - window:SetWidth (342) - window:SetHeight (190) + window.enviar:SetSize (342/2 - 15, 20) + + window:SetWidth (342/2 + 5) + window:SetHeight (195) window:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) window:SetBackdropColor (1, 1, 1, 1) window:SetBackdropBorderColor (0, 0, 0, 1) @@ -747,6 +746,9 @@ local function cria_drop_down (este_gump) window.title:SetTextColor (.8, .8, .8, 1) window.title:Show() + + window:SetClampedToScreen (true) + for _, widget in ipairs (window.elvui_widgets) do widget:Show() end @@ -973,7 +975,8 @@ local function cria_drop_down (este_gump) b.icon:SetVertexColor (unpack (artwork.color or {})) end - b:Show() + --b:Show() + b:Hide() i = i + 1 end end @@ -987,7 +990,7 @@ local function cria_drop_down (este_gump) local last_reported_label = window:CreateFontString (nil, "overlay", "GameFontNormal") window.last_reported_label = last_reported_label - window.last_reported_label:SetText (Loc ["STRING_REPORTHISTORY"] .. ":") + window.last_reported_label:SetText (Loc ["STRING_REPORTHISTORY"] .. ":") --this string could be removed from localization for i = 1, window.max_last_buttons do local b = CreateFrame ("button", "DetailsReportWindowRRB" .. i, window) @@ -1001,8 +1004,21 @@ local function cria_drop_down (este_gump) b:SetScript ("OnClick", recently_on_click) tinsert (window.recently_report_buttons, b) end + + history_Background:Hide() + separador:Hide() + window.last_reported_label:Hide() --> scritps + + local flashTexture = window:CreateTexture (nil, "background") + flashTexture:SetColorTexture (1, 1, 1) + flashTexture:SetAllPoints() + + local onShowAnimation = DetailsFramework:CreateAnimationHub (flashTexture, function() flashTexture:Show() end, function() flashTexture:Hide() end) + DetailsFramework:CreateAnimation (onShowAnimation, "ALPHA", 1, .2, 0, .10) + DetailsFramework:CreateAnimation (onShowAnimation, "ALPHA", 2, .2, .10, 0) + window:SetScript ("OnShow", function (self) local dropdown = window.select.MyObject local where = _detalhes.report_where @@ -1010,6 +1026,8 @@ local function cria_drop_down (este_gump) local list = window.dropdown_func() local found + onShowAnimation:Play() + for index, option in ipairs (list) do if (option.value == where) then dropdown:Select (where) @@ -1046,7 +1064,7 @@ local function cria_drop_down (este_gump) _detalhes.last_report_id = nil end) - --> bot�o de fechar + --> close button window.fechar = CreateFrame ("Button", nil, window, "UIPanelCloseButton") window.fechar:SetScript ("OnClick", function() gump:Fade (window, 1) diff --git a/startup.lua b/startup.lua index 6d33db3d..2efc29d2 100644 --- a/startup.lua +++ b/startup.lua @@ -1292,6 +1292,9 @@ function _G._detalhes:Start() --> check is this is the first run of this version if (self.is_version_first_run) then + + + local enable_reset_warning = true local lower_instance = _detalhes:GetLowerInstanceNumber()