Quantcast

More tweaks to slot filtering.

pschifferer [05-10-09 - 13:49]
More tweaks to slot filtering.
Filename
CauldronMainUI.lua
CauldronTradeskill.lua
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 444115b..f2e9707 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -1639,40 +1639,68 @@ function Cauldron:InvSlotDropDown_Initialize(level)

 	UIDropDownMenu_SetText(CauldronFiltersInvSlotDropDown, L["Slots"]);

-	local all = {
-		text = L["All slots"],
-		checked = false,
-		tooltipTitle = L["All slots"],
-		func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end,
-		arg1 = "all",
-		arg2 = "",
-	};
+	local all = UIDropDownMenu_CreateInfo();
+	all.text = ALL_INVENTORY_SLOTS; -- L["All slots"],
+--		checked = false,
+--		tooltipTitle = L["All slots"],
+	all.func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end;
+	all.arg1 = "all";
+--		arg2 = "",
+--	};
 	UIDropDownMenu_AddButton(all);

-	local none = {
-		text = L["(None)"],
-		checked = true,
-		tooltipTitle = L["(None)"],
-		func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end,
-		arg1 = "none",
-		arg2 = "",
-	};
+	local none = UIDropDownMenu_CreateInfo();
+	none.text = L["(None)"];
+	none.checked = true;
+--		tooltipTitle = L["(None)"],
+	none.func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end;
+	none.arg1 = "none";
+--		arg2 = "",
+--	};
 	UIDropDownMenu_AddButton(none);

 	local slots = Cauldron:GetSlots(Cauldron.vars.playername, skillName);

 	for name, _ in pairs(slots) do
+		self:debug("InvSlotDropDown_Initialize: name="..tostring(name));
 		if name ~= "" then
-			local slot = {
-				text = _G[name],
-				checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[name],
-				tooltipTitle = _G[name],
-				func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end,
-				arg1 = name,
-				arg2 = "",
-			};
+			local slot = UIDropDownMenu_CreateInfo();
+			slot.text = _G[name];
+			slot.checked = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[name];
+--				tooltipTitle = _G[name],
+			slot.func = function(arg1, arg2) Cauldron:InvSlotDropDown_SetSlot(arg1) end;
+			slot.arg1 = name;
+--				arg2 = "",
+--			};
 			UIDropDownMenu_AddButton(slot);
-		end
+			--[[
+				UIDropDownMenu_SetSelectedID(TradeSkillInvSlotDropDown, nil);
+				local allChecked = GetTradeSkillInvSlotFilter(0);
+				local info = UIDropDownMenu_CreateInfo();
+				local filterCount = select("#", ...);
+				info.text = ALL_INVENTORY_SLOTS;
+				info.func = TradeSkillInvSlotDropDownButton_OnClick;
+				info.checked = allChecked;
+				UIDropDownMenu_AddButton(info);
+				local checked;
+				for i=1, filterCount, 1 do
+					if ( allChecked and filterCount > 1 ) then
+						checked = nil;
+						UIDropDownMenu_SetText(TradeSkillInvSlotDropDown, ALL_INVENTORY_SLOTS);
+					else
+						checked = GetTradeSkillInvSlotFilter(i);
+						if ( checked ) then
+							UIDropDownMenu_SetText(TradeSkillInvSlotDropDown, select(i, ...));
+						end
+					end
+					info.text = select(i, ...);
+					info.func = TradeSkillInvSlotDropDownButton_OnClick;
+					info.checked = checked;
+
+					UIDropDownMenu_AddButton(info);
+				end
+			--]]
+	end
 	end

 --@alpha@
@@ -1706,7 +1734,7 @@ function Cauldron:SlotsFilterAllCheck()
 end

 function Cauldron:InvSlotDropDown_SetSlot(info)
-	self:debug("InvSlotDropDown_SetSlot enter");
+	-- self:debug("InvSlotDropDown_SetSlot enter");

 	local skillName = CURRENT_TRADESKILL;
 	if IsTradeSkillLinked() then
@@ -1732,11 +1760,11 @@ function Cauldron:InvSlotDropDown_SetSlot(info)
 		end
 	else
 		self:debug("InvSlotDropDown_SetSlot: select a specific slot: "..info.arg1);
-		if not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1] then
-			Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1] = true;
-		else
+--		if not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1] then
+--			Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1] = true;
+--		else
 			Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1] = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.slots[info.arg1];
-		end
+--		end
 	end

 	self:debug("InvSlotDropDown_SetSlot exit");
diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index c0f8b1b..f2bfe7b 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -136,6 +136,8 @@ function Cauldron:UpdateSkills()
 --					if not skillDB.window.slots[slot] then
 						skillDB.window.slots[slot] = true;
 --					end
+--				else
+--					skillDB.window.slots["None"] = true;
 				end

 				-- populate the reagent list