changeset 36:f62d582c5c52

Use new Frame widget method EnableResize. Allow deleting loot item's history entry along with the main loot entry.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 09 Dec 2011 03:16:59 +0000
parents f75329fe5758
children cd745a18d7c7
files core.lua gui.lua
diffstat 2 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/core.lua	Thu Dec 08 08:24:59 2011 +0000
+++ b/core.lua	Fri Dec 09 03:16:59 2011 +0000
@@ -1772,6 +1772,27 @@
 		self:Print("Reassigned entry %d/%s from '%s' to '%s'.", index, e.itemlink, from_name, to_name)
 	end
 
+	-- Similar to _addHistoryEntry.  The second arg may be a loot entry
+	-- (which used to be at LOOTINDEX), or nil (and the loot entry will
+	-- be pulled from LOOTINDEX instead).
+	function addon:_delHistoryEntry (lootindex, opt_e)
+		local e = opt_e or g_loot[lootindex]
+		if e.kind ~= 'loot' then return end
+
+		local from_i, from_h, hist_i = self:_history_by_loot_id (e, "delete")
+		if not from_i then
+			-- from_h is the formatted error text
+			self:Print(from_h .. "  Loot will be deleted, but history will NOT be updated.", e.itemlink)
+			return
+		end
+
+		--[[local hist_h = ]]tremove (from_h, hist_i)
+		tsort (from_h, comp)
+		self.hist_clean = nil
+
+		self:Print("Removed history entry %d/%s from '%s'.", lootindex, e.itemlink, e.person)
+	end
+
 	-- Any extra work for the "Mark as <x>" dropdown actions.  The
 	-- corresponding <x> will already have been assigned in the loot entry.
 	local deleted_cache = {} --setmetatable({}, {__mode='k'})
--- a/gui.lua	Thu Dec 08 08:24:59 2011 +0000
+++ b/gui.lua	Fri Dec 09 03:16:59 2011 +0000
@@ -429,6 +429,9 @@
 		local gone = tremove(g_loot,rowi)
 		addon:Print("Removed %s.",
 			gone.itemlink or gone.bosskill or gone.startday.text)
+		if gone.kind == 'loot' and IsShiftKeyDown() then
+			addon:_delHistoryEntry (rowi, gone)
+		end
 	end,
 
 	["Delete this history event"] = function(rowi)
@@ -545,7 +548,7 @@
 		"Mark as normal|This is the default.  Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.",
 		"--",
 		"Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.",
-		"Delete this loot event|Permanent, no going back!",
+		"Delete this loot event|Permanent, no going back!\n\nHold down the Shift key to also delete the player's corresponding History entry.",
 		"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.",
 		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.",
 		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.",
@@ -1779,16 +1782,9 @@
 	display:SetStatusText(self.status_text)
 	display:SetLayout("Flow")
 	display:SetStatusTable{width=900,height=550}   -- default height is 500
-	-- prevent resizing, also see ace3 tickets 80 and 214
-	-- grrrr, no longer works after frame rewrite
-	--[[
-	display.sizer_se:SetScript("OnMouseDown",nil)
-	display.sizer_se:SetScript("OnMouseUp",nil)
-	display.sizer_s:SetScript("OnMouseDown",nil)
-	display.sizer_s:SetScript("OnMouseUp",nil)
-	display.sizer_e:SetScript("OnMouseDown",nil)
-	display.sizer_e:SetScript("OnMouseUp",nil)
-	]]
+	if display.EnableResize then -- FIXME after next Ace3 release, this can be assumed
+		display:EnableResize(false)
+	end
 	display:SetCallback("OnClose", function(_display)
 		UIDROPDOWNMENU_SHOW_TIME = prev_fade_time 
 		_d = _display:GetUserData("eoiST")