From 3460dd57fb95022c92d8ce1bb66121028340155e Mon Sep 17 00:00:00 2001 From: Peter Eliasson Date: Sun, 8 Feb 2015 15:17:44 +0100 Subject: [PATCH] Report window now again hidden on esc. --- src/report.lua | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/report.lua b/src/report.lua index 472cfc4..a8f103b 100644 --- a/src/report.lua +++ b/src/report.lua @@ -156,9 +156,9 @@ end -- Hides and releases the report frame if it is show, -- if it is not shown this does nothing. function report:HideReportFrame() - if self.currentFrame then - self.currentFrame:Release(); - self.currentFrame = nil; + if self.reportFrame then + self.reportFrame:Release(); + self.reportFrame = nil; end end @@ -219,7 +219,7 @@ function report:ShowReportFrame(guildId, zoneId, difficultyId, encounterId, role local numParses = numToSendSlider:GetValue(); local whisperToName = whisperToNameEditBox:GetText(); self:SendData(channelId, whisperToName, dataTitle, filterString, parses, numParses); - report:HideReportFrame(); + self:HideReportFrame(); end); frame:AddChild(dataTitleLabel); @@ -231,6 +231,24 @@ function report:ShowReportFrame(guildId, zoneId, difficultyId, encounterId, role frame:AddChild(numToSendSlider); frame:AddChild(sendButton); - self.currentFrame = frame; + self.reportFrame = frame; frame:Show(); -end \ No newline at end of file +end + +function report:OnCloseSpecialWindows() + local found; + if self.reportFrame then + self:HideReportFrame() + found = 1 + end + return self.hooks["CloseSpecialWindows"]() or found; +end + +function report:OnEnable() + self:RawHook("CloseSpecialWindows", "OnCloseSpecialWindows", true); +end + +function report:OnDisable() + self:HideReportFrame(); + self:UnHook("CloseSpecialWindows"); +end -- 1.7.9.5