quickslots now has it's own settings, so it can be turned on/off (default: off) independent of the rest of inventory

AssemblerManiac [06-04-18 - 12:41]
quickslots now has it's own settings, so it can be turned on/off (default: off) independent of the rest of inventory
Filename
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
IIfA/IIfASceneFuncs.lua
diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 6e726fa..ef2fdce 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -452,6 +452,7 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, qty, itemLink, itemName, loca
 	-- item count is either passed or we have to get it from bag/slot ID or item link
 	local bAddQty = false
 	if qty ~= nil then bAddQty = true end
+
 	local itemCount = qty or getItemCount(bagId, slotId, itemLink)

 	--p("trying to save <<1>> x<<2>>", itemLink, itemCount)
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index d0f29a6..b190a01 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -154,7 +154,7 @@ local function fgb4(...)
 	IIfA_EventDump(...)
 end
 local function fgb5(...)
-	d("gb items ready")
+	d("inventory fragment state change")
 	IIfA_EventDump(...)
 end

@@ -206,6 +206,7 @@ function IIfA:RegisterForEvents()

 	--    ZO_QuickSlot:RegisterForEvent(EVENT_ABILITY_COOLDOWN_UPDATED, IIfA_EventDump)
 	ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) IIfA:ProcessRightClick(rowControl) end)
+
 end


diff --git a/IIfA/IIfASceneFuncs.lua b/IIfA/IIfASceneFuncs.lua
index e58fbe8..8999738 100644
--- a/IIfA/IIfASceneFuncs.lua
+++ b/IIfA/IIfASceneFuncs.lua
@@ -37,22 +37,34 @@ function IIfA:RegisterForSceneChanges()
 			end
 		end
 	end
+
+	INVENTORY_FRAGMENT:RegisterCallback("StateChange", function(...)
+	   	IIfA:ProcessInventoryTabChange("", ...)
+	end)
+	CRAFT_BAG_FRAGMENT:RegisterCallback("StateChange", function(...)
+	   	IIfA:ProcessInventoryTabChange("", ...)
+	end)
+	WALLET_FRAGMENT:RegisterCallback("StateChange", function(...)
+	   	IIfA:ProcessInventoryTabChange("", ...)
+	end)
+	QUICKSLOT_FRAGMENT:RegisterCallback("StateChange", function(...)
+	   	IIfA:ProcessInventoryTabChange("_quickSlots", ...)
+	end)
 end

 function IIfA:GetSceneSettings(sceneName)

 	sceneName = sceneName or IIfA:GetCurrentSceneName()
-
-
 	local settings = IIfA:GetSettings().frameSettings
-
 	if not settings[sceneName] then
 		-- if we have to create a new set of scene info, register it in the scene change too, it'll be set again during next opening

 		local scene = SCENE_MANAGER:GetScene(sceneName)
-		scene:RegisterCallback("StateChange", function(...)
-				IIfA:ProcessSceneChange(sceneName, ...)
-			end)
+		if scene then
+			scene:RegisterCallback("StateChange", function(...)
+					IIfA:ProcessSceneChange(sceneName, ...)
+				end)
+		end
 		-- save the settings in the settings table, base it on HUD
 		settings[sceneName] = ZO_DeepTableCopy(settings["hud"])
 		settings[sceneName].hidden = true
@@ -68,6 +80,23 @@ function IIfA:ProcessSceneChange(sceneName, oldState, newState)
 	-- IIfA:DebugOut(zo_strformat("ProcessSceneChange <<1>>: <<2>> -> <<3>>", sceneName, oldState, newState))
 	if SCENE_SHOWN == newState then
 		sceneName = IIfA:GetCurrentSceneName()
+		if sceneName == "inventory" then
+			if not QUICKSLOT_FRAGMENT:IsHidden() then
+				sceneName = sceneName .. "_quickslots"
+			end
+		end
+		local settings = IIfA:GetSceneSettings(sceneName)
+		self:RePositionFrame(settings)
+	elseif SCENE_HIDDEN == newState then
+		IIFA_GUI:SetHidden(true)
+	end
+end
+
+
+function IIfA:ProcessInventoryTabChange(tabName, oldState, newState)
+	-- IIfA:DebugOut(zo_strformat("ProcessSceneChange <<1>>: <<2>> -> <<3>>", oldState, newState))
+	if newState == SCENE_SHOWN then
+		sceneName = "inventory" .. tabName
 		local settings = IIfA:GetSceneSettings(sceneName)
 		self:RePositionFrame(settings)

@@ -81,6 +110,10 @@ function IIfA:SaveFrameInfo(calledFrom)
 	if (calledFrom == "onHide") then return end

 	local sceneName = IIfA:GetCurrentSceneName()
+	if not QUICKSLOT_FRAGMENT:IsHidden() then
+		sceneName = sceneName .. "_quickslots"
+	end
+
 	local settings = IIfA:GetSceneSettings(sceneName)

     settings.hidden = IIFA_GUI:IsControlHidden()
@@ -95,7 +128,7 @@ function IIfA:SaveFrameInfo(calledFrom)
 	end
 end

--- called only from bindings.xml on keypress
+-- called from bindings.xml on keypress, and on /iifa toggle chat cmd
 function IIfA:ToggleInventoryFrame()
 	IIFA_GUI:SetHidden(not IIFA_GUI:IsControlHidden())
 	if not IIFA_GUI:IsControlHidden() then