diff LibFarmbuyer.lua @ 69:8442272a8418

- Make sure popup dialogs are on top of Ace3's widgets. - Minor code reorganization. Safety hook for future boss-entry code. - Avoid same bug from a couple revs ago when adding manual boss kills. - Ask players about snapshot data when manually entering boss kills. - Blizzard rearranged the button order in 3-entry popups some time ago and I failed to adapt the code until now.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 11 May 2012 03:08:12 +0000
parents 81d5449621f8
children 32eb24fb2ebf
line wrap: on
line diff
--- a/LibFarmbuyer.lua	Wed May 09 09:38:14 2012 +0000
+++ b/LibFarmbuyer.lua	Fri May 11 03:08:12 2012 +0000
@@ -54,7 +54,7 @@
   Ditto for table recycling.
 ]]
 
-local MAJOR, MINOR = "LibFarmbuyer", 16
+local MAJOR, MINOR = "LibFarmbuyer", 17
 assert(LibStub,MAJOR.." requires LibStub")
 local lib = LibStub:NewLibrary(MAJOR, MINOR)
 if not lib then return end
@@ -167,10 +167,16 @@
 	StaticPopupDialogs[dialog.which].OnAccept (dialog, dialog.data, dialog.data2)
 	dialog:Hide()
 end
-local function OnShow_witheditbox (dialog, data)
+local function OnShow_ontop (dialog, data)
 	local info = StaticPopupDialogs[dialog.which]
-	--dialog[info.hasWideEditBox and "wideEditBox" or "editBox"]:SetFocus()
-	dialog.editBox:SetFocus()
+	-- ace3's elements are hardcoded to this strata, make sure popups
+	-- can also be seen (their toplevel=true attribute handles the
+	-- framelevels within the same strata)
+	info.saved_strata = dialog:GetFrameStrata()
+	dialog:SetFrameStrata("FULLSCREEN_DIALOG")
+	if info.hasEditBox then
+		dialog.editBox:SetFocus()
+	end
     if info.farm_OnShow then
         return info.farm_OnShow (dialog, data)
     end
@@ -183,9 +189,14 @@
         return info.farm_OnAccept (dialog, data, data2)
     end
 end
-local function OnHide_cleanup (dialog)
+local function OnHide_cleanup (dialog, data)
+	local info = StaticPopupDialogs[dialog.which]
+    if info.farm_OnHide then
+        return info.farm_OnHide (dialog, data)
+    end
 	dialog.data = nil
 	dialog.data2 = nil
+	dialog:SetFrameStrata(info.saved_strata or "DIALOG")
 end
 
 --[[
@@ -195,10 +206,6 @@
 	if t.hasEditBox then
 		t.EditBoxOnTextChanged = EditBoxOnTextChanged_notempty
 		t.EditBoxOnEnterPressed = EditBoxOnEnterPressed_accept
-		if t.OnShow then
-			t.farm_OnShow = t.OnShow
-		end
-		t.OnShow = OnShow_witheditbox
 		if t.OnAccept then
 			t.farm_OnAccept = t.OnAccept
 		end
@@ -207,9 +214,10 @@
 		t.EditBoxOnEscapePressed = StaticPopup_EscapePressed
 	end
 
-	if not t.OnHide then
-		t.OnHide = OnHide_cleanup
-	end
+	t.farm_OnShow = t.OnShow
+	t.OnShow = OnShow_ontop
+	t.farm_OnHide = t.OnHide
+	t.OnHide = OnHide_cleanup
 
 	t.timeout = 0
 	t.whileDead = true