Quantcast

- Remove additional data - Extras; it was causing issues on new toons and other grief.

urnati [12-21-22 - 01:07]
- Remove additional data - Extras; it was causing issues on new toons and other grief.
- More cleanup of plugin options (TitanPanel.lua) to ensure they are working.
Filename
Titan/TitanConfig.lua
Titan/TitanPanel.lua
Titan/TitanUtils.lua
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index d70f4f5..027e63b 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -29,7 +29,7 @@ Highlight - notes. tips. and details
 local notes = ""
 	..TitanUtils_GetRedText("NOTE : ")
 	..TitanUtils_GetNormalText(""
-		.."Currently the menu & bag frame and the status / xp frame are NOT adjustable via WoW Edit Mode. In the Titan Configuration - Bottom Bars - you may adjust the menu & bag frame and the status / xp frame *vertically only*.\n"
+		.."Currently the menu & bag frame and the status / xp frame are NOT adjustable via edit mode. In the Titan Configuration for Bottom Bars you may adjust the menu & bag frame and the status / xp frame *vertically only*.\n"
 		)
 local changes = ""
 	..TitanUtils_GetGoldText("6.00.11.100002 : 2020/12/20\n")
@@ -45,7 +45,6 @@ local changes = ""
 	..TitanUtils_GetHighlightText(""
 		.."- About : Add slash command description to About.\n"
 		.."- Changes : Added to show change history.\n"
-		.."- Extras : Begin gathering more plugin details so users have more info to determine whether to remove plugin settings.\n"
 		)
 	..TitanUtils_GetGoldText("6.00.10.100002 : 2020/12/13\n")
 	..TitanUtils_GetGreenText("TitanBag : \n")
@@ -1337,15 +1336,14 @@ local optionsExtras = {
 	args = {}
  }
 --[[ local
-NAME: TitanUpdateExtras
+NAME: TitanUpdateAddonAttempts
 DESC: Show plugins that are not registered (loaded) but have config data. The data can be deleted by the user.
 VAR:  None
 OUT:  None
 NOTE:
 - As users change the plugins they use the old ones still have saved variable data stored by Titan.
-- This allows even built-ins to be listed in case Titan removes them or the user disables them.
 - The old plugin data can be removed by the user when they will not longer use that plugin.
-- This routine will 'redraw' the list as a user deletes data.
+- This routine is called to 'redraw' the list as a user deletes data.
 - A message is sent to chat that the plugin data has been deleted.
 :NOTE
 --]]
@@ -1361,47 +1359,18 @@ local function TitanUpdateExtras()
 		name = L["TITAN_PANEL_EXTRAS_DESC"].."\n",
 		cmdHidden = true
 	}
----[===[
-	local iname = ""
-	local ival = 0
-	for idx, value in pairs(TitanPluginSettings) do
-		if TitanPluginSettings[idx] and TitanUtils_IsPluginRegistered(idx) then
-			-- Plugin is being used.
-		else
-			ival = ival + 1
-			iname = tostring(ival)
-			local extra = {}
-			if TitanPluginExtras and TitanPluginExtras[idx] then
-				-- found extra data for user
-				extra = TitanPluginExtras[idx]
-			else
-				extra = {
-						name ="?",
-						menuText = "?",
-						version = "?",
-						category = "?",
-						}
-			end
---[[
-print("TConfig extras"
-.." "..tostring(idx)..""
-.." "..tostring(TitanUtils_IsPluginRegistered(idx))..""
-.." "..tostring(extra.name)..""
-)
---]]
-			args[idx] = {
+	for idx, value in pairs(TitanPluginExtras) do
+		if TitanPluginExtras[idx] then
+			local num = TitanPluginExtras[idx].num
+			local name = TitanPluginExtras[idx].id
+			args[name] = {
 				type = "group",
-				name = TitanUtils_GetGoldText(idx or "?"),
-				order = ival,
+				name = TitanUtils_GetGoldText(tostring(num)..": "..(name or "?")),
+				order = idx,
 				args = {
 					name = {
 						type = "description",
-						name = ""
-							..TitanUtils_GetGoldText("Name: "..idx or "?").."\n"
-							..TitanUtils_GetGoldText("Version: "..extra.version or "?").."\n"
-							..TitanUtils_GetGoldText("Text: "..extra.menuText or "?").."\n"
-							..TitanUtils_GetGoldText("Category: "..extra.category or "?").."\n"
-							,
+						name = TitanUtils_GetGoldText(name or "?"),
 						cmdHidden = true,
 						order = 10,
 					},
@@ -1409,16 +1378,11 @@ print("TConfig extras"
 						name = L["TITAN_PANEL_EXTRAS_DELETE_BUTTON"],
 						order = 15, type = "execute", width = "full",
 						func = function(info, v)
-							local pname = info[1]
-							TitanPluginSettings[pname] = nil -- delete the plugin settings
-							if TitanPluginExtras and TitanPluginExtras[pname] then
-								TitanPluginExtras[pname] = nil -- delete the extra plugin info
-							else
-								-- nothing to do; no error
-							end
+							TitanPluginSettings[info[1]] = nil -- delete the config entry
 							TitanPrint(
 								" '"..info[1].."' "..L["TITAN_PANEL_EXTRAS_DELETE_MSG"]
 								, "info")
+							TitanVariables_ExtraPluginSettings() -- rebuild the list
 							TitanUpdateExtras() -- rebuild the options config
 							AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") -- tell Ace to redraw
 						end,
@@ -1428,15 +1392,6 @@ print("TConfig extras"
 		end
 	end

-	if ival == 0 then
-		args["none"] = {
-			order = 10,
-			type = "description",
-			name = "\n\n\n"..TitanUtils_GetGoldText(NONE or "None."),
-			cmdHidden = true
-		}
-	end
---]===]
 	AceConfigRegistry:NotifyChange("Titan Panel Addon Extras")
 end
 -------------
@@ -1831,8 +1786,8 @@ local function TitanUpdateConfigAddons()
 					set = function(info, v)
 						local bar = TitanUtils_GetWhichBar(info[1])
 						TitanToggleVar(info[1], "DisplayOnRightSide");
---						TitanPanel_RemoveButton(info[1]);
---						TitanUtils_AddButtonOnBar(bar, info[1]);
+						TitanPanel_RemoveButton(info[1]);
+						TitanUtils_AddButtonOnBar(bar, info[1]);
 						TitanPanelButton_UpdateButton(info[1])
 					end,
 				}
diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua
index 3b97559..79d8b5a 100644
--- a/Titan/TitanPanel.lua
+++ b/Titan/TitanPanel.lua
@@ -314,9 +314,7 @@ function TitanPanel_PlayerEnteringWorld()
 		TitanVariables_InitTitanSettings();

 		-- only do this sort of initialization on the first PEW event
-		if TitanAllGetVar("Silenced") then
-			-- per user request
-		else
+		if not TitanAllGetVar("Silenced") then
 			TitanPrint("", "header")
 		end

@@ -372,37 +370,8 @@ function TitanPanel_PlayerEnteringWorld()
 		end

 	end
-	-- sanity checks to ensure the base tables are set
-	if (TitanSettings) then
-		-- all is good
-	else
-		TitanSettings = {}
-	end
-	-- check for player list per issue #745
-	if TitanSettings.Players then
-		-- all is good
-	else
-		-- Create the table so profile(s) can be added
-		TitanSettings.Players = {}
-	end
-	if (TitanAll) then
-		-- all is good
-	else
-		TitanAll = {};
-	end
-
 	local _ = nil
 	TitanSettings.Player,_,_ = TitanUtils_GetPlayer()
-	local player_settings = TitanSettings.Players[TitanSettings.Player]
-	-- Used for Config > Extras
-	if player_settings.Extra then
-		-- We have some data
-	else
-		player_settings.Extra = {}
-	end
-	-- TitanPluginExtras must be set BEFORE registering plugins.
-	-- This table will build up until the user cleans up via Config > Extras
-	TitanPluginExtras = player_settings.Extra
 	-- Some addons wait to create their LDB component or a Titan addon could
 	-- create additional buttons as needed.
 	-- So we need to sync their variables and set them up
@@ -1422,10 +1391,9 @@ function TitanPanel_InitPanelButtons()
 				-- position the plugin relative to the prior plugin
 				-- or the bar if it is the 1st
 				r_prior = prior[TitanPanelSettings.Location[i]].right
-				r_spacing = r_prior.x * scale
 				-- =========================
 				button:ClearAllPoints();
-				button:SetPoint("RIGHT", _G[r_prior.button]:GetName(), r_prior.anchor, (-r_spacing), r_prior.y);
+				button:SetPoint("RIGHT", _G[r_prior.button]:GetName(), r_prior.anchor, (-(r_prior.x) * scale), r_prior.y);

 				-- =========================
 				-- capture the button for the next plugin
@@ -1910,10 +1878,10 @@ local function TitanPanel_PlayerSettingsMenu()
 				info.text = L["TITAN_PANEL_MENU_SHOW_ICON"];
 				info.value = {plugin.id, "ShowIcon", nil};
 				info.func = function()
-					TitanPanelRightClickMenu_ToggleVar({plugin.id, "ShowIcon", nil})
+					TitanPanelRightClickMenu_ToggleVar({info.value[1], "ShowIcon", nil})
 				end
 				info.keepShownOnClick = 1;
-				info.checked = TitanGetVar(plugin.id, "ShowIcon");
+				info.checked = TitanGetVar(info.value[1], "ShowIcon");
 				info.disabled = nil;
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
@@ -1924,10 +1892,10 @@ local function TitanPanel_PlayerSettingsMenu()
 				info.text = L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"];
 				info.value = {plugin.id, "ShowLabelText", nil};
 				info.func = function()
-					TitanPanelRightClickMenu_ToggleVar({plugin.id, "ShowLabelText", nil})
+					TitanPanelRightClickMenu_ToggleVar({info.value[1], "ShowLabelText", nil})
 				end
 				info.keepShownOnClick = 1;
-				info.checked = TitanGetVar(plugin.id, "ShowLabelText");
+				info.checked = TitanGetVar(info.value[1], "ShowLabelText");
 				info.disabled = nil;
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
@@ -1938,10 +1906,10 @@ local function TitanPanel_PlayerSettingsMenu()
 				info.text = L["TITAN_PANEL_MENU_SHOW_PLUGIN_TEXT"]
 				info.value = {plugin.id, "ShowRegularText", nil};
 				info.func = function()
-					TitanPanelRightClickMenu_ToggleVar({plugin.id, "ShowRegularText", nil})
+					TitanPanelRightClickMenu_ToggleVar({info.value[1], "ShowRegularText", nil})
 				end
 				info.keepShownOnClick = 1;
-				info.checked = TitanGetVar(plugin.id, "ShowRegularText");
+				info.checked = TitanGetVar(info.value[1], "ShowRegularText");
 				info.disabled = nil;
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
@@ -1952,10 +1920,10 @@ local function TitanPanel_PlayerSettingsMenu()
 				info.text = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"];
 				info.value = {plugin.id, "ShowColoredText", nil};
 				info.func = function()
-					TitanPanelRightClickMenu_ToggleVar({plugin.id, "ShowColoredText", nil})
+					TitanPanelRightClickMenu_ToggleVar({info.value[1], "ShowColoredText", nil})
 				end
 				info.keepShownOnClick = 1;
-				info.checked = TitanGetVar(plugin.id, "ShowColoredText");
+				info.checked = TitanGetVar(info.value[1], "ShowColoredText");
 				info.disabled = nil;
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
@@ -1964,13 +1932,14 @@ local function TitanPanel_PlayerSettingsMenu()
 			if plugin.controlVariables.DisplayOnRightSide then
 				info = {};
 				info.text = L["TITAN_PANEL_MENU_LDB_SIDE"];
+				info.value = {plugin.id, "DisplayOnRightSide", nil};
 				info.func = function ()
-					TitanToggleVar(plugin.id, "DisplayOnRightSide")
---					local bar = TitanUtils_GetWhichBar(id)
---					TitanPanel_RemoveButton(id);
---					TitanUtils_AddButtonOnBar(bar, id);
+					TitanToggleVar(info.value[1], "DisplayOnRightSide")
+					local bar = TitanUtils_GetWhichBar(id)
+					TitanPanel_RemoveButton(id);
+					TitanUtils_AddButtonOnBar(bar, id);
 				end
-				info.checked = TitanGetVar(plugin.id, "DisplayOnRightSide");
+				info.checked = TitanGetVar(info.value[1], "DisplayOnRightSide");
 				info.disabled = nil;
 				TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
 			end
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index 3bdcbfd..4525759 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -766,22 +766,20 @@ OUT:  None
 --]]
 function TitanPanelRightClickMenu_AddToggleRightSide(id, level)
 	local plugin = TitanUtils_GetPlugin(id)
-	if plugin.controlVariables and plugin.controlVariables.DisplayOnRightSide == true then
-		TitanPanelRightClickMenu_AddToggleVar(L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"], id, "DisplayOnRightSide", nil, level);
---[===[
+	if plugin.controlVariables and plugin.controlVariables.DisplayOnRightSide then
+		-- copy of TitanPanelRightClickMenu_AddToggleVar adding a remove button
 		local info = {};
 		info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"];
 		info.value = {id, "DisplayOnRightSide"};
 		info.func = function()
+			local bar = TitanUtils_GetWhichBar(id)
 			TitanPanelRightClickMenu_ToggleVar({id, "DisplayOnRightSide"})
---			local bar = TitanUtils_GetWhichBar(id)
---			TitanPanel_RemoveButton(id);
---			TitanUtils_AddButtonOnBar(bar, id)
+			TitanPanel_RemoveButton(id);
+			TitanUtils_AddButtonOnBar(bar, id)
 		end
 		info.checked = TitanGetVar(id, "DisplayOnRightSide");
 		info.keepShownOnClick = 1;
 		UIDropDownMenu_AddButton(info, level);
---]===]
 	end
 end

@@ -1475,6 +1473,7 @@ local function TitanUtils_RegisterPluginProtected(plugin)
 							TitanPlugins[id].menuText = TitanPlugins[id].id;
 						end
 						TitanPlugins[id].menuText = NoColor(TitanPlugins[id].menuText)
+
 						table.insert(TitanPluginsIndex, self.registry.id);
 						table.sort(TitanPluginsIndex,
 							function(a, b)
@@ -1491,26 +1490,6 @@ local function TitanUtils_RegisterPluginProtected(plugin)
 									< string.lower(TitanPlugins[b].menuText);
 							end
 						);
-
-						--[[ TitanPluginExtras : Add to 'extras' to give user more info on which plugin settings to get rid of.
-						As the user adds plugins (Titan or LDB) this array will build up -
-						with the cooresponding settings info - until the user purges data from from the table.
-
-						The table is saved under TitanSettings.
-						--]]
-						local ldb_cat = ""
-						if TitanPlugins[id] and TitanPlugins[id].ldb then
-							ldb_cat = ""
-								.." ["..TitanPlugins[id].ldb.."]"
-						else
-							ldb_cat = ""
-						end
-						TitanPluginExtras[id] = {
-							name = tostring(id or "?"),
-							menuText = tostring(TitanPlugins[id].menuText or "?"),
-							version = tostring(TitanPlugins[id].version or "?"),
-							category = tostring(TitanPlugins[id].category or "?")..ldb_cat,
-							}
 					end
 				end
 				if issue ~= "" then