Version 1.1.6 (05-07-2020)

Jarth [07-06-20 - 08:49]
Version 1.1.6 (05-07-2020)
- Renamed saved setting: MenuShowDisabled to Menu.ShowDisabled
- Fixed issue where it was not possible to collapse "Appearance" in categories
-- Now it stores the value at runtime, and not in the saved variables
Filename
CBs_Constants.lua
CBs_Settings_Data.lua
CBs_Settings_List.lua
Changelog
CollectionBars.lua
CollectionBars.txt
diff --git a/CBs_Constants.lua b/CBs_Constants.lua
index 73e39fe..c044d0e 100644
--- a/CBs_Constants.lua
+++ b/CBs_Constants.lua
@@ -7,7 +7,7 @@ Filename: CBs_Constants.lua
 -------------------------------------------------------------------------------------------------
 CollectionBars = {
     WM = GetWindowManager(),
-    Addon = {Name = "CollectionBars", DisplayName = "Collection Bars", Abbreviation = "CBs", Version = 1.1, MinorVersion = 5, SettingsSlash = "/cb", Author = "Jarth"},
+    Addon = {Name = "CollectionBars", DisplayName = "Collection Bars", Abbreviation = "CBs", Version = 1.1, MinorVersion = 6, SettingsSlash = "/cb", Author = "Jarth"},
     AllButtons = {},
     Default = {
         UseAccountSettings = true,
@@ -66,7 +66,8 @@ CollectionBars = {
             [7] = {Name = "InFence", Instance = SCENE_MANAGER:GetScene("fence_keyboard"), Description = "%s at a fence"},
             [8] = {Name = "InStore", Instance = SCENE_MANAGER:GetScene("store"), Description = "%s at a store"}
         },
-        HighestUnlocked = 0
+        HighestUnlocked = 0,
+        ShowChildren = {Appearance = true}
     },
     Categories = {},
     CategoriesOrdered = {},
@@ -165,11 +166,10 @@ function base.AddCategory(type, categoryData, parentIcons, hasChildren, parentKe
         AutoSelectAll = false,
         Selected = {},
         Enabled = false,
-        MenuShowDisabled = false,
         Tooltip = {Show = true, Position = TOP},
         Bar = {IsCombined = true, HideAll = true, Depth = 0, Width = 0, Horizontal = true, Offset = {X = CENTER, Y = CENTER}},
-        Label = {Show = true, EnableHideAll = true, Display = categoryName, Offset = {X = 0, Y = 0}, Height = 19, Width = 75, Font = "ZoFontGameSmall", Position = BOTTOMLEFT, PositionTarget = TOPLEFT},
-        ShowChildren = true
+        Menu = {ShowDisabled = false},
+        Label = {Show = true, EnableHideAll = true, Display = categoryName, Offset = {X = 0, Y = 0}, Height = 19, Width = 75, Font = "ZoFontGameSmall", Position = BOTTOMLEFT, PositionTarget = TOPLEFT}
     }
 end

diff --git a/CBs_Settings_Data.lua b/CBs_Settings_Data.lua
index 03ffde3..b4421d0 100644
--- a/CBs_Settings_Data.lua
+++ b/CBs_Settings_Data.lua
@@ -369,9 +369,9 @@ function base.AppendMasterListTypeCollectibles(self, listType)
     self:AppendRow_Checkbox(listType, {
         name = string.format("Show disabled %s", self.category.Name),
         tooltipText = string.format("When ON disabled elements will be shown for %s", self.category.Name),
-        funcGet = function() return self.category.Saved.MenuShowDisabled end,
+        funcGet = function() return self.category.Saved.Menu.ShowDisabled end,
         funcSet = function(_, newValue)
-            self.category.Saved.MenuShowDisabled = newValue
+            self.category.Saved.Menu.ShowDisabled = newValue
             base:CreateCategory(self.category)
             base.Global.Settings.List:RefreshData()
         end
@@ -404,7 +404,7 @@ function base.AppendMasterListTypeCollectibles(self, listType)
     })
     self:AppendRow_Divider(listType, {})
     for _, collectible in ipairs(self.category.CollectionOrdered) do
-        if self.category.Saved.MenuShowDisabled and collectible.Disabled or not collectible.Disabled then
+        if not collectible.Disabled or self.category.Saved.Menu.ShowDisabled and collectible.Disabled then
             self:AppendRow_Checkbox(listType, {
                 cId = collectible.Id,
                 name = string.format("Show %s", collectible.Name),
diff --git a/CBs_Settings_List.lua b/CBs_Settings_List.lua
index 95784d7..053fe9b 100644
--- a/CBs_Settings_List.lua
+++ b/CBs_Settings_List.lua
@@ -94,13 +94,13 @@ function CBs_Settings_List:AppendRow_Category_Title(listType, data)
 end

 function CBs_Settings_List:SetupRow_Category_Title(control, data)
-    base:Debug("CBs_Settings_List:SetupRow_Category_Title", control, data)
+    base:Info("CBs_Settings_List:SetupRow_Category_Title", control, data)
     control.data = data
     ZO_SortFilterList.SetupRow(self, control, control.data)
     control:SetHandler("OnMouseUp", function()
-        local savedTypeData = base.Saved.Categories[data.Id]
-        if savedTypeData ~= nil then
-            savedTypeData.ShowChildren = not savedTypeData.ShowChildren
+        local showChildren = base.Global.ShowChildren[data.name]
+        if (showChildren ~= nil) then
+            showChildren = not showChildren
             base.Global.Settings.List:RefreshFilters()
         end
     end)
@@ -379,19 +379,17 @@ function CBs_Settings_List:BuildMasterList()
 end

 function CBs_Settings_List:FilterScrollList()
-    base:Debug("CBs_Settings_List:FilterScrollList")
+    base:Info("CBs_Settings_List:FilterScrollList")
     local scrollData = ZO_ScrollList_GetDataList(self.list)
     ZO_ClearNumericallyIndexedTable(scrollData)
-
-    for i = 1, #self.masterList do
-        if self.masterListType == nil or self.masterListType == self.masterList[i].listType then
-            if self.masterListType == "Categories" and self.masterList[i].parentKey ~= nil then
-                local savedTypeData = base.Saved.Categories[self.masterList[i].parentKey]
-                if savedTypeData ~= nil and savedTypeData.ShowChildren or savedTypeData == nil then
-                    scrollData[#scrollData + 1] = ZO_ScrollList_CreateDataEntry(self.masterList[i].dataTypeId, self.masterList[i])
-                end
+    for _, listElement in ipairs(self.masterList) do
+        if self.masterListType == nil or self.masterListType == listElement.listType then
+            if self.masterListType == "Categories" and listElement.parentKey ~= nil then
+                local showChildren = base.Global.ShowChildren[listElement.parentKey] or false
+                base:Info("FilterScrollList", base.Global.ShowChildren, listElement.parentKey, base.Global.ShowChildren[listElement.parentKey])
+                if showChildren then scrollData[#scrollData + 1] = ZO_ScrollList_CreateDataEntry(listElement.dataTypeId, listElement) end
             else
-                scrollData[#scrollData + 1] = ZO_ScrollList_CreateDataEntry(self.masterList[i].dataTypeId, self.masterList[i])
+                scrollData[#scrollData + 1] = ZO_ScrollList_CreateDataEntry(listElement.dataTypeId, listElement)
             end
         end
     end
diff --git a/Changelog b/Changelog
index c98be38..2690839 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
 -------------------------------------------------------------------------------
  Collection bars
 -------------------------------------------------------------------------------
+Version 1.1.6 (05-07-2020)
+- Renamed saved setting: MenuShowDisabled to Menu.ShowDisabled
+- Fixed issue where it was not possible to collapse "Appearance" in categories
+-- Now it stores the value at runtime, and not in the saved variables
+
 Version 1.1.5 (04-07-2020)
 - Reverted fix in 1.1.5, and fixed issue properly by changing the load order
 -- Now fetches the settings twice, first to set logging, and then set settings
diff --git a/CollectionBars.lua b/CollectionBars.lua
index ef22d25..daa9afb 100644
--- a/CollectionBars.lua
+++ b/CollectionBars.lua
@@ -65,7 +65,7 @@ function base:CreateCategory(category)
     for index, collectibleData in ZO_CollectibleCategoryData.SortedCollectibleIterator(category.CategoryData, {ZO_CollectibleData.IsShownInCollection}) do
         local isUnlocked = collectibleData:IsUnlocked()
         -- TODO: Insert if new, update if exists...
-        if isUnlocked or category.Saved.MenuShowDisabled then
+        if isUnlocked or category.Saved.Menu.ShowDisabled then
             local collectibleId = collectibleData:GetId()
             -- TODO: IMPLEMENT BETTER TOOLTIPS...     function ZO_Tooltip:LayoutCollectible(collectibleId, deprecatedCollectionName, collectibleName, collectibleNickname, isPurchasable, description, hint, deprecatedArg, categoryType, showVisualLayerInfo, cooldownSecondsRemaining, showBlockReason)
             category.Collection[collectibleId] = {
diff --git a/CollectionBars.txt b/CollectionBars.txt
index 86fe02e..f8a4b54 100644
--- a/CollectionBars.txt
+++ b/CollectionBars.txt
@@ -6,8 +6,8 @@

 ## APIVersion: 100031
 ## Title: Collection Bars
-## AddOnVersion: 10105
-## Version: 1.1.5
+## AddOnVersion: 10106
+## Version: 1.1.6
 ## Author: Jarth
 ## Description: Show collection bars and activate collections with key or button press. Shortcuts: Settings window: /cb OptionalDependsOn: LibDebugLogger (Logging can be enabled in settings)
 ##