diff core.lua @ 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
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'})