diff Modules/Scanner.lua @ 106:d3fbb5676a5e

Added tooltips to the item refill window headers. Now color coding the availibility of items at the item refill window. Added a hide help text option (which is off by default). Renamed all premade groups to a new naming pattern; ?Profession - Category - Detail?, e.g. ?Inscription - Glyphs by class - Death Knight?. To continue getting notified about updates to a selected premade group, you must re-add them. Repositioned elements of the item refill frame to fit better. No longer using colorsargs to remember the index of a queued move, but instead providing a reference to the move itself in the new ?rowData? property of each row. Added tooltips to the headers of the sort table. Merged missing and available columns together (showing available / missing) and sorting on available now sorts on percentage of how many of the missing items are available. Moving and available columns are now aligned to the right. Added an ?extra? config group which contains the additional (but completely optional) settings. Moved color codes adjustments, forget character, auto refill skip confirm and hide help info options to this group.
author Zerotorescue
date Wed, 12 Jan 2011 19:58:39 +0100
parents 6ae44d372360
children 3bbad0429d87
line wrap: on
line diff
--- a/Modules/Scanner.lua	Wed Jan 12 14:15:50 2011 +0100
+++ b/Modules/Scanner.lua	Wed Jan 12 19:58:39 2011 +0100
@@ -172,66 +172,39 @@
 		if addon.db.profile.defaults.autoRefillSkipConfirm then
 			OnMoveAccept(true);
 		else
-			local data = {};
-			
+			-- This table is never copied, just referenced. It is the same for every row.
 			local columns = {
 				{
-					value = function(d, cols, realrow, column, table)
-						return IdToItemLink(d[realrow].colorargs[2]);
+					value = function(data, cols, realrow, column, table)
+						return IdToItemLink(data[realrow].rowData.id);
 					end,
 				}, -- item
 				{
-					value = function(d, cols, realrow, column, table)
-						local queue = Mover:GetMoves();
-						return queue[d[realrow].colorargs[1]].num;
+					value = function(data, cols, realrow, column, table)
+						return data[realrow].rowData.num;
 					end,
 				}, -- moving
 				{
-					value = function(d, cols, realrow, column, table)
-						local queue = Mover:GetMoves();
-						return queue[d[realrow].colorargs[1]].missing;
+					value = function(data, cols, realrow, column, table)
+						return addon:DisplayItemCount(data[realrow].rowData.available, data[realrow].rowData.missing); -- available / missing
 					end,
-				}, -- missing
-				{
-					value = function(d, cols, realrow, column, table)
-						local queue = Mover:GetMoves();
-						return queue[d[realrow].colorargs[1]].available;
+					color = function(data, cols, realrow, column, table)
+						return ((data[realrow].rowData.available < data[realrow].rowData.missing) and { r = 1, g = 0, b = 0, a = 1 }) or { r = 1, g = 1, b = 1, a = 1 };
 					end,
-					color = function(d, cols, realrow, column, table)
-						local queue = Mover:GetMoves();
-						return ((queue[d[realrow].colorargs[1]].available < queue[d[realrow].colorargs[1]].missing) and { r = 1, g = 0, b = 0, a = 1 }) or { r = 1, g = 1, b = 1, a = 1 };
-					end,
-				}, -- available
+				}, -- missing / available
 			};
 			
-			local queue = Mover:GetMoves();
+			-- Store the list with rows in this
+			local data = {};
 			
 			for i, move in pairs(Mover:GetMoves()) do
-				local row = {
-					["colorargs"] = { i, queue[i].id },
+				table.insert(data, {
+					["rowData"] = move, -- this is not a key usually found in a row item and ignored by the library
 					["cols"] = columns,
-				};
-				
-				table.insert(data, row);
+				});
 			end
 			
 			addon:SetMoverFrameData(data);
-			
-			--[[
-			StaticPopupDialogs["InventoriumRefill"] = {
-				text = "There are items that can be refilled from this location, do you wish to proceed?",
-				button1 = YES,
-				button2 = NO,
-				OnAccept = function()
-					mod:Pause();
-					Mover:BeginMove(location, self.Unpause);
-				end,
-				timeout = 0,
-				whileDead = 1,
-				hideOnEscape = 1,
-				exclusive = 1,
-			};
-			StaticPopup_Show("InventoriumRefill");]]
 		end
 	end
 end
@@ -258,7 +231,6 @@
 	
 	mod:UnregisterEvent("BANKFRAME_CLOSED");
 	
-	--StaticPopup_Hide("InventoriumRefill");
 	InventoriumItemMover:Hide();
 	Mover:ResetQueue();
 end
@@ -295,7 +267,6 @@
 	
 	self:CancelTimer(tmrScanGuild, true); -- silent
 	
-	--StaticPopup_Hide("InventoriumRefill");
 	InventoriumItemMover:Hide();
 	Mover:ResetQueue();
 end