comparison Config.lua @ 75:2127ab01ed4a

Overriding toggle boxes should no longer give errors. Adding / removing items from config groups works again. Fixed full support for the Cauldron crafting addon. No longer trying to queue crafting items when no tradeskill window is open. This would cause errors.
author Zerotorescue
date Sat, 25 Dec 2010 15:33:40 +0100
parents 6329ee822172
children 958aba5f3297
comparison
equal deleted inserted replaced
74:8d11fc88ecab 75:2127ab01ed4a
22 elseif value and info.arg then 22 elseif value and info.arg then
23 -- If this override is now enabled, we need to copy the default into this field (unless it is not nil (which is supposed to be impossible), in which case we'll use the already selected value) 23 -- If this override is now enabled, we need to copy the default into this field (unless it is not nil (which is supposed to be impossible), in which case we'll use the already selected value)
24 24
25 local inheritedValue = addon:GetOptionByKey(groupName, info.arg); 25 local inheritedValue = addon:GetOptionByKey(groupName, info.arg);
26 26
27 addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) ~= "table" and inheritedValue) or CopyTable(inheritedValue); -- copying defaults by reference would let one (unintendedly) change the defaults 27 addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) == "table" and CopyTable(inheritedValue)) or inheritedValue; -- copying defaults by reference would let one (unintendedly) change the defaults
28 end 28 end
29 end 29 end
30 30
31 if multiSelectEnabled ~= nil then 31 if multiSelectEnabled ~= nil then
32 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created. 32 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created.
93 return tostring( 7 - (itemRarity or 0) ) .. (itemName or ""); 93 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
94 end, 94 end,
95 get = function(info) 95 get = function(info)
96 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side 96 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
97 end, 97 end,
98 set = function(groupId, itemId) 98 set = function(groupId, itemData)
99 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info. 99 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
100 100
101 if itemId then 101 if itemData and itemData.id then
102 local groupName = groupIdToName[groupId]; 102 local groupName = groupIdToName[groupId];
103 103
104 if not mod:AddItemToGroup(groupName, itemId) then 104 if not mod:AddItemToGroup(groupName, itemData.id) then
105 print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r"); 105 print("|cffff0000Couldn't add the item with itemId (" .. itemData.id .. ") because it is already in a group.|r");
106 end 106 end
107 end 107 end
108 end, 108 end,
109 width = "double", 109 width = "double",
110 dialogControl = "ConfigItemLinkButton", 110 dialogControl = "ConfigItemLinkButton",
118 return tostring( 7 - (itemRarity or 0) ) .. (itemName or ""); 118 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
119 end, 119 end,
120 get = function(info) 120 get = function(info)
121 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side 121 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
122 end, 122 end,
123 set = function(groupId, itemId) 123 set = function(groupId, itemData)
124 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info. 124 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
125 125
126 if itemId then 126 if itemData and itemData.id then
127 local groupName = groupIdToName[groupId]; 127 local groupName = groupIdToName[groupId];
128 128
129 mod:RemoveItemFromGroup(groupName, itemId); 129 mod:RemoveItemFromGroup(groupName, itemData.id);
130 130
131 -- Now rebuild the list 131 -- Now rebuild the list
132 AceConfigRegistry:NotifyChange("InventoriumOptions"); 132 AceConfigRegistry:NotifyChange("InventoriumOptions");
133 end 133 end
134 end, 134 end,