diff --git a/Titan/Titan.lua b/Titan/Titan.lua index 73bd355..fb94ce5 100644 --- a/Titan/Titan.lua +++ b/Titan/Titan.lua @@ -42,15 +42,20 @@ end ---Titan Give the user a 'are you sure' popup whether to reset current toon back to default Titan settings. function TitanPanel_ResetToDefault() +--[[ StaticPopupDialogs["TITAN_RESET_BAR"] = { text = TitanUtils_GetNormalText(L["TITAN_PANEL_MENU_TITLE"]) .. "\n\n" .. L["TITAN_PANEL_RESET_WARNING"], button1 = ACCEPT, button2 = CANCEL, OnAccept = function(self) + -- build debug output + local str = "/titan reset" + .." "..tostring(TITAN_PROFILE_RESET).."" + Titan_Debug.Out('titan', 'profile', str) TitanVariables_UseSettings(TitanSettings.Player, TITAN_PROFILE_RESET); IsTitanPanelReset = true; - ReloadUI() +-- ReloadUI() end, showAlert = 1, timeout = 0, @@ -58,6 +63,16 @@ function TitanPanel_ResetToDefault() hideOnEscape = 1 }; StaticPopup_Show("TITAN_RESET_BAR"); +--]] + + -- Found as of 2025 Sep, the reload is not needed + -- build debug output + local str = "/titan reset" + .." "..tostring(TITAN_PROFILE_RESET).."" + Titan_Debug.Out('titan', 'profile', str) + + TitanVariables_UseSettings(TitanSettings.Player, TITAN_PROFILE_RESET); + IsTitanPanelReset = true; end ---Titan The user wants to save a custom Titan profile. Show the user the dialog boxes to make it happen. @@ -278,7 +293,7 @@ function TitanPanel_PlayerEnteringWorld(reload) if Titan__InitializedPEW then -- Currently no additional steps needed else - Titan_Global.dbg:Out("Tooltip", "PEW: Init settings") + Titan_Debug.Out('titan', 'p_e_w', "Init settings") -- Get Profile and Saved Vars TitanVariables_InitTitanSettings(); @@ -297,16 +312,16 @@ function TitanPanel_PlayerEnteringWorld(reload) -- Set the two anchors in their default positions -- until the Titan bars are drawn - Titan_Global.dbg:Out("Tooltip", "PEW: Create anchors for other addons") + Titan_Debug.Out('titan', 'p_e_w', "Create anchors for other addons") TitanPanelTopAnchor:ClearAllPoints(); TitanPanelTopAnchor:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 0, 0); TitanPanelBottomAnchor:ClearAllPoints(); TitanPanelBottomAnchor:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); -- Ensure the bars are created before the plugins are registered. - Titan_Global.dbg:Out("Tooltip", "PEW: Create frames for Titan bars") + Titan_Debug.Out('titan', 'p_e_w', "Create frames for Titan bars") for idx, v in pairs(TitanBarData) do - Titan_Global.dbg:Out("Tooltip", "... ".. tostring(v.name)) + Titan_Debug.Out('titan', 'bars_setup', "... ".. tostring(v.name)) TitanPanelButton_CreateBar(idx) end @@ -332,7 +347,7 @@ function TitanPanel_PlayerEnteringWorld(reload) end -- Should be safe to register for events that could show / hide Bars - Titan_Global.dbg:Out("Tooltip", "PEW: Register for events Titan needs") + Titan_Debug.Out('titan', 'p_e_w', "Register for events Titan needs") RegisterForEvents() end @@ -343,16 +358,18 @@ function TitanPanel_PlayerEnteringWorld(reload) -- Some addons wait to create their LDB component or a Titan addon could -- create additional buttons as needed. - Titan_Global.dbg:Out("Tooltip", "PEW: Register any plugins found") + Titan_Debug.Out('titan', 'p_e_w', "Register any plugins found") TitanUtils_RegisterPluginList() - Titan_Global.dbg:Out("Tooltip", "> PEW: Register any plugins done") + Titan_Debug.Out('titan', 'p_e_w', "> Register any plugins done") -- Now sync saved variables to the profile chosen by the user. -- This will set the bar(s) and enabled plugins (via OnShow). - Titan_Global.dbg:Out("Tooltip", "PEW: Synch plugin saved vars") + Titan_Debug.Out('titan', 'p_e_w', "Synch plugin saved vars") + + Titan_Debug.Out('titan', 'p_e_w', "Synch plugin saved vars") TitanVariables_UseSettings(nil, TITAN_PROFILE_INIT) - Titan_Global.dbg:Out("Tooltip", "PEW: Init config data (right click menu)") + Titan_Debug.Out('titan', 'p_e_w', "Init config data (right click menu)") -- all addons are loaded so update the config (options) -- some could have registered late... TitanUpdateConfig("init") @@ -383,11 +400,11 @@ function TitanPanel_PlayerEnteringWorld(reload) end -- Loop through the LDB objects to sync with their created Titan plugin - Titan_Global.dbg:Out("Tooltip", "PEW: Register any LDB (Titan) plugins") + Titan_Debug.Out('titan', 'p_e_w', "Register any LDB (Titan) plugins") TitanLDBRefreshButton() - Titan_Global.dbg:Out("Tooltip", "> PEW: Register any LDB (Titan) plugins done") + Titan_Debug.Out('titan', 'p_e_w', "> Register any LDB (Titan) plugins done") - Titan_Global.dbg:Out("Tooltip", "PEW: Titan processing done") + Titan_Debug.Out('titan', 'p_e_w', "Titan processing done") end -------------------------------------------------------------- @@ -415,7 +432,7 @@ function TitanPanelBarButton:ADDON_LOADED(addon) if addon == TITAN_ID then _G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD") - Titan_Global.dbg:Out("Tooltip", "ADDON_LOADED") + Titan_Debug.Out('titan', 'events', "ADDON_LOADED") -- Unregister event - saves a few event calls. self:UnregisterEvent("ADDON_LOADED"); @@ -428,7 +445,7 @@ function TitanPanelBarButton:PLAYER_ENTERING_WORLD(arg1, arg2) local call_success = nil local ret_val = nil - Titan_Global.dbg:Out("Tooltip", "Titan PLAYER_ENTERING_WORLD pcall setup routine") + Titan_Debug.Out('titan', 'p_e_w', "Titan PLAYER_ENTERING_WORLD pcall setup routine") call_success, -- needed for pcall ret_val = -- actual return values @@ -721,7 +738,7 @@ local function handle_giu_cmds(cmd_list) -- so the below does not work as expected... end ----local Helper to handle 'profile' commands - Set to profile if not using global profile. +---local Helper to handle profile commands - Set to profile if not using global profile. ---@param cmd_list table local function handle_profile_cmds(cmd_list) local cmd = cmd_list[1] @@ -1433,12 +1450,10 @@ end ---Titan Show all the Titan bars the user has selected. ---@param reason string Debug note on where the call initiated function TitanPanelBarButton_DisplayBarsWanted(reason) - local trace = false - if trace then - print("_DisplayBarsWanted" - .. " " .. tostring(reason) .. "" - ) - end + -- build debug output + local str = "_DisplayBarsWanted" + .." "..tostring(reason).."" + Titan_Debug.Out('titan', 'bars_setup', str) -- Check all bars to see if the user has requested they be shown for idx, v in pairs(TitanBarData) do @@ -1451,6 +1466,10 @@ function TitanPanelBarButton_DisplayBarsWanted(reason) if Titan_Global.switch.can_edit_ui then -- Not needed with UI movable widgets + -- build debug output + local str = "_DisplayBarsWanted" + .." UI user editable - skip adj frames" + Titan_Debug.Out('titan', 'bars_setup', str) else -- Adjust other frames because the bars shown / hidden may have changed TitanPanel_AdjustFrames(true, "_DisplayBarsWanted") @@ -1476,7 +1495,8 @@ local function showBar(frame_str) or frame_str == TitanVariables_GetFrameName("Bar2") then -- ===== Battleground or Arena : User selected - if (TitanPanelGetVar("HideBarsInPVP")) +-- if (TitanPanelGetVar("HideBarsInPVP")) + if TitanBarDataVars[frame_str].hide_in_pvp and (C_PvP.IsBattleground() or C_PvP.IsArena() -- or GetZoneText() == "Stormwind City" @@ -1489,7 +1509,8 @@ local function showBar(frame_str) -- ===== In Combat : User selected if TitanBarDataVars[frame_str].hide_in_combat - or TitanPanelGetVar("HideBarsInCombat") then +-- or TitanPanelGetVar("HideBarsInCombat") + then if in_combat then -- InCombatLockdown() too slow flag = false end @@ -2427,12 +2448,11 @@ end function TitanPanel_InitPanelBarButton(reason) -- Set initial Panel Scale TitanPanel_SetScale(); - --[[ -print("_InitPanelBarButton" -.." "..tostring(reason).."" -) ---]] + -- build debug output + local str = "_InitPanelBarButton" + .." "..tostring(reason).."" + Titan_Debug.Out('titan', 'bars_setup', str) TitanPanelBarButton_DisplayBarsWanted("InitPanelBarButton") end diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua index 531fc59..d06e024 100644 --- a/Titan/TitanAutoHide.lua +++ b/Titan/TitanAutoHide.lua @@ -13,8 +13,9 @@ For documentation, this is treated as a Titan plugin --]===] local AceTimer = LibStub("AceTimer-3.0") local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) -local Dewdrop = nil -if AceLibrary and AceLibrary:HasInstance("Dewdrop-2.0") then Dewdrop = AceLibrary("Dewdrop-2.0") end + +-- Dropped Ace Dewdrop lib as of 2025 Sep; last updated 2008 Sep +-- Dropped Ace Tablet lib as of 2025 Sep; last updated 2009 Jan -- local routines @@ -134,8 +135,7 @@ end ---@param frame string Titan bar name function Handle_OnUpdateAutoHide(frame) if TitanPanelRightClickMenu_IsVisible() - or (Tablet20Frame and Tablet20Frame:IsVisible()) - or (Dewdrop and Dewdrop:IsOpen())then + then return end diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 2d702a2..65613cd 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -591,6 +591,7 @@ local function TitanUpdateConfigBars(t, pos) type = "toggle", width = .75, --"fill", name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], + desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], order = position, get = function(info) local frame_str = TitanVariables_GetFrameName(info[1]) @@ -602,6 +603,23 @@ local function TitanUpdateConfigBars(t, pos) not TitanBarDataVars[frame_str].hide_in_combat end, } + position = position + 1 -- PvP hide toggle + args[v.name].args.hideinpvp = { + type = "toggle", + width = .75, --"fill", + name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"].." PvP", + desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].hide_in_pvp + end, + set = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].hide_in_pvp = + not TitanBarDataVars[frame_str].hide_in_pvp + end, + } position = position + 1 -- spacer args[v.name].args.transpacer1 = { order = position, @@ -893,64 +911,7 @@ local function TitanUpdateConfigBarsAll(t, pos) width = "full", name = " ", } - position = position + 1 - args.confcombatdesc = { - order = position, - width = "full", - type = "header", - name = L["TITAN_PANEL_MENU_COMMAND"], - } - position = position + 1 - args.setcombatuseglobal = { - name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], - desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], - order = position, - type = "toggle", - width = "full", - get = function() return TitanPanelGetVar("HideBarsInCombat") end, - set = function() TitanPanelToggleVar("HideBarsInCombat"); end, - } - position = position + 1 - args.arenaspacer = { -- spacer - order = position, - type = "description", - width = "full", - name = " ", - } - position = position + 1 - args.confarenadesc = { - order = position, - width = "full", - type = "header", - name = BATTLEGROUND .. " / " .. ARENA, - } - position = position + 1 - args.setarenauseglobal = { - name = HIDE .. " " .. L["TITAN_PANEL_MENU_TOP_BARS"] - .. " - " .. BATTLEGROUND .. " / " .. ARENA, - desc = "Hide" - .. " " .. TitanBarData[TitanVariables_GetFrameName("Bar")].locale_name - .. " and" - .. " " .. TitanBarData[TitanVariables_GetFrameName("Bar2")].locale_name - .. " in " .. BATTLEGROUND .. " / " .. ARENA, - order = position, - type = "toggle", - width = "full", - --disabled = (TITAN_ID == "Titan~Classic"), --? Allow in all version ?? - get = function() return TitanPanelGetVar("HideBarsInPVP") end, - set = function() - TitanPanelToggleVar("HideBarsInPVP") - TitanPanelBarButton_DisplayBarsWanted("HideBarsInPVP" - .. " " .. tostring(TitanPanelGetVar("HideBarsInPVP"))) - end, - } - position = position + 1 - args.topbarspacer = { -- spacer - order = position, - type = "description", - width = "full", - name = " ", - } + position = position + 1 args.conftopbardesc = { order = position, @@ -960,8 +921,8 @@ local function TitanUpdateConfigBarsAll(t, pos) } position = position + 1 args.settopbar = { - name = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], + name = L["TITAN_PANEL_MENU_TOP_BARS"].." "..L["TITAN_PANEL_MENU_DISABLE_PUSH"], +-- desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], order = position, type = "toggle", width = "full", @@ -985,8 +946,8 @@ local function TitanUpdateConfigBarsAll(t, pos) } position = position + 1 args.setbottombar = { - name = L["TITAN_PANEL_MENU_DISABLE_PUSH"], - desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], + name = L["TITAN_PANEL_MENU_BOTTOM_BARS"].." "..L["TITAN_PANEL_MENU_DISABLE_PUSH"], +-- desc = L["TITAN_PANEL_MENU_DISABLE_PUSH"], order = position, type = "toggle", width = "full", @@ -995,205 +956,6 @@ local function TitanUpdateConfigBarsAll(t, pos) set = function() TitanPanel_AuxScreenAdjustReload() end, } - --====== Global skins options - position = position + 1 - args.confbottombardesc = { - order = position, - width = "full", - type = "header", - name = L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], - } - -- Background group - position = position + 1 -- background - args.background = { - name = "", - type = "group", - inline = true, - order = position, - args = { - setskinuseglobal = { - name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], - desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], - order = 20, - type = "select", - width = "full", - style = "radio", - get = function(info) - return TitanBarDataVars["Global"].texure - end, - set = function(_, v) - TitanBarDataVars["Global"].texure = v - for idx, val in pairs(TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - --AceConfigRegistry:NotifyChange("Titan Panel Globals") - end, - values = { - [Titan_Global.SKIN] = L["TITAN_PANEL_SKINS_TITLE"], - [Titan_Global.COLOR] = COLOR, - [Titan_Global.NONE] = NONE, - }, - }, - --====== Skins options - skinsoptions = { - name = "", - type = "group", - order = 100, - hidden = function(info) - return IfHide(Titan_Global.SKIN) - end, - args = { - confskindesc = { - order = 120, - width = "full", - type = "description", - name = "", --L["TITAN_PANEL_SKINS_TITLE"], - }, - setskinglobal = { - order = 130, - type = "select", - width = "normal", - name = " ", --L["TITAN_PANEL_SKINS_LIST_TITLE"], - desc = L["TITAN_PANEL_SKINS_SET_DESC"], - get = function(info) - return TitanBarDataVars["Global"].skin.path - end, - set = function(_, v) - TitanBarDataVars["Global"].skin.path = v --TitanPanelSetVar("TexturePath", v); - if TitanBarDataVars["Global"].texure == Titan_Global.SKIN then - for idx, val in pairs(TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - end - end, - values = function() - local Skinlist = {} - local v; - for _, v in pairs(TitanSkins) do - if v.path ~= TitanBarDataVars["Global"].skin.path then --TitanPanelGetVar("TexturePath") then - Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.green) - else - Skinlist[v.path] = TitanUtils_GetHexText(v.name, Titan_Global.colors.yellow) - end - end - table.sort(Skinlist, function(a, b) - return string.lower(TitanSkins[a].name) - < string.lower(TitanSkins[b].name) - end) - return Skinlist - end, - }, - show_skin_top_desc = { - type = "description", - name = "", - order = 140, - width = "5", - }, - show_skin_global_top = { - type = "description", - name = "", - image = function() - return TitanBarDataVars["Global"].skin.path .. "TitanPanelBackgroundTop0" - end, - imageWidth = 256, - order = 150, - width = .5, - }, - show_trans_slider = { - type = "range", - width = "full", - name = L["TITAN_PANEL_TRANS_MENU_TEXT_SHORT"], - order = 160, - min = 0, - max = 1, - step = 0.01, - get = function(info) - return TitanBarDataVars["Global"].skin.alpha - end, - set = function(info, a) - TitanBarDataVars["Global"].skin.alpha = a - for idx, val in pairs(TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - end, - }, - }, - }, - - --====== Color options - coloroptions = { - name = "", - type = "group", - order = 200, - hidden = function(info) - return IfHide(Titan_Global.COLOR) - end, - args = { - confcolordesc = { - order = 100, - width = "full", - type = "description", - name = "", --COLOR, - }, - show_skin_color_picker = { - type = "color", - width = "Full", - name = "Select Bar Color", -- L["TITAN_PANEL_MENU_RESET_POSITION"], - order = 110, - hasAlpha = true, - get = function(info) - local color = TitanBarDataVars["Global"].color - return color.r, - color.g, - color.b, - color.alpha - end, - set = function(info, r, g, b, a) - TitanBarDataVars["Global"].color.r = r - TitanBarDataVars["Global"].color.g = g - TitanBarDataVars["Global"].color.b = b - TitanBarDataVars["Global"].color.alpha = a - if TitanBarDataVars["Global"].texure == Titan_Global.COLOR then - for idx, val in pairs(TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - end - end, - }, - confcolortrans = { - order = 130, - width = "full", - type = "description", - name = function() - local res ="" - ..L["TITAN_PANEL_TRANS_MENU_TEXT_SHORT"].." " - ..tostring(format("%0.1f", TitanBarDataVars["Global"].color.alpha)) - - return res - end, - }, - }, - }, - - --====== None options - noneoptions = { - name = "", - type = "group", - order = 300, - hidden = function(info) - return IfHide(Titan_Global.NONE) - end, - args = { - confcolordesc = { - order = 100, - width = "full", - type = "description", - name = NONE, - }, - }, - }, - }, - } end local function BuildBarsAll() @@ -2928,42 +2690,6 @@ local optionsAdvanced = { }, }, }, - devoutputdesc = { - name = "Developer Only", - type = "group", - inline = true, - order = 200, - args = { - confdesc = { - order = 110, - type = "description", - name = "Debug Output", - cmdHidden = true - }, - advname = { - name = "Tooltip", - desc = "Tooltip debug output to Chat", - order = 120, - type = "toggle", - width = "full", - get = function() return Titan_Global.debug.tool_tips end, - set = function(_, a) - Titan_Global.debug.tool_tips = not Titan_Global.debug.tool_tips - end, - }, - advplugins = { - name = "Plugin", - desc = "Plugin debug output to Chat", - order = 130, - type = "toggle", - width = "full", - get = function() return Titan_Global.debug.plugin_text end, - set = function(_, a) - Titan_Global.debug.plugin_text = not Titan_Global.debug.plugin_text - end, - }, - }, - }, }, } diff --git a/Titan/TitanDebug.lua b/Titan/TitanDebug.lua index e51360b..fdd635b 100644 --- a/Titan/TitanDebug.lua +++ b/Titan/TitanDebug.lua @@ -1,5 +1,5 @@ --[===[ File -This file contains the debug class to be used throughout Titan Panel and plugins. +This file contains the debug class used throughout Titan Panel and plugins. This file is loaded first so NO other Titan routines are to be used. @@ -33,117 +33,47 @@ local function Encode(color, text) return res end -local function Out_Error(plugin_id, topic_id, topic_text) - local msg = "" - .. Encode(err_color, - date("%H:%M:%S") - .. " <" .. tostring(plugin_id) - .. ":" .. topic_id .. "> ") -- yellow gold - .. " " .. Encode(text_color, tostring(topic_text) - ) -- - - _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) -end - -local function Out_debug(plugin_id, topic_id, topic_text) - local msg = "" - .. Encode(head_color, - date("%H:%M:%S") - .. " <" .. tostring(plugin_id) - .. ":" .. topic_id .. "> ") -- yellow gold - .. " " .. Encode(text_color, tostring(topic_text) - ) -- - - _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) -end - ----@class PluginDebugType ----@field plugin_id string Plugin / Addon name ----@field enabled boolean Whether this particular plugin debug is enabled ----@field topics table Index of topics (true / false) ----@field New function ----@field AddTopic function ----@field Out function ----@field EnableDebug function ----@field EnableTopic function - ----API Return a disabled debug class with default topics. Each plugin is welcome to add more topics. ----@param id string ----@return PluginDebugType ---- debug_obj = Titan_Debug.New("Titan") -function Titan_Debug:New(id) - local this = {} -- new object - setmetatable(this, self) -- create handle lookup; self == Titan_Debug - self.__index = self - - -- Init object - this.plugin_id = id - this.enabled = false - this.topics = { - ["Events"] = false, - ["Flow"] = false, - ["Tooltip"] = false, - ["Menu"] = false, - } - return this ---@type PluginDebugType -end - ----Add a topic to the created debug class ----@param topic_id string ---- debug_obj.Add("Startup") -function Titan_Debug:AddTopic(topic_id) - -- A bit harsh but do not override a topic - if self.topics[topic_id] == nil then - self.topics[topic_id] = false - else - Out_Error(self.plugin_id, self.topics[topic_id], " Attempt to override (" .. topic_id .. ")'") - end -end - ----Output a debug string under a topic id ----@param topic_id number +---Simple debug to output plugin/Titan, the topic, and info +---@param who string +---@param topic string ---@param str string ---- debug_info.Out(1, "OnEvent") -function Titan_Debug:Out(topic_id, str) - if self.enabled == true then -- debug enabled for this object - if self.topics[topic_id] == true -- exists and was enabled - then - Out_debug(self.plugin_id, topic_id, str) - else - -- silent return - end +function Titan_Debug.Out(who, topic, str) + + if Titan_Debug[who] + and Titan_Debug[who][topic] + and Titan_Debug[who][topic] == true + then + local msg = "" + .. Encode(head_color, + date("%H:%M:%S") + .. " <" .. tostring(who) .. "" + .. " : " .. tostring(topic) .. ">" + ) + .. Encode(text_color, + " " .. str .. "" + ) + + _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) else - -- silent return + -- silently proceed end end ----@param action boolean ---- debug_info.EnableDebug(true) -function Titan_Debug:EnableDebug(action) - if self.enabled ~= action then - -- Inform dev of change - local msg = (action == true and "Enabled" or "Disabled") - Out_debug(self.plugin_id, "Events", msg) - else - -- silent - end - - self.enabled = action -end - ----Enable / disable debug the topic within this id ----@param id number ----@param action boolean ---- debug_info.EnableTopic(1, true) ---- debug_info.EnableTopic(1, false) -function Titan_Debug:EnableTopic(id, action) - self.topics[id] = action -end - ---[[ - local msg = "Debug Enable topic" - .." "..tostring(self.plugin_id) - .." "..tostring(id) - .." > "..tostring(self.topics[id].enabled) - _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) - --]] +-- For debug across Titan Panel +-- Keep two levels deep, to use .Out !!! +-- Titan_Debug.<plugin or 'titan'>.<debug topic> +-- +Titan_Debug.titan = {} +Titan_Debug.titan.bars_setup = false +Titan_Debug.titan.events = false +Titan_Debug.titan.ldb_setup = false +Titan_Debug.titan.menu = false +Titan_Debug.titan.p_e_w = false -- player entering world +Titan_Debug.titan.plugin_text = false +Titan_Debug.titan.plugin_register = false +Titan_Debug.titan.plugin_register_deep = false +Titan_Debug.titan.plugin_drag_drop = false +Titan_Debug.titan.profile = false +Titan_Debug.titan.movable = false +Titan_Debug.titan.startup = false +Titan_Debug.titan.tool_tips = false diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua index c55899f..75320e3 100644 --- a/Titan/TitanGlobal.lua +++ b/Titan/TitanGlobal.lua @@ -167,17 +167,6 @@ Titan_Global.SKIN = "skin" Titan_Global.COLOR = "color" Titan_Global.NONE = "none" --- For debug across Titan Panel -Titan_Global.debug = {} -Titan_Global.debug.events = false -Titan_Global.debug.ldb_setup = false -Titan_Global.debug.menu = false -Titan_Global.debug.tool_tips = false -Titan_Global.debug.plugin_text = false -Titan_Global.debug.plugin_register = false -Titan_Global.debug.plugin_register_deep = false -Titan_Global.debug.movable = false - -- For WoW localized strings / literals we are using Titan_Global.literals = { low = LOW, @@ -238,12 +227,3 @@ function Titan_Global.NewRegistry(id) local reg = { id = id } ---@type PluginRegistryType return reg end - --- Set the debug topics for Titan itself - not any plugins -Titan_Global.dbg = Titan_Debug:New("Titan") -Titan_Global.dbg:AddTopic("Startup") -Titan_Global.dbg:AddTopic("Vars") - -Titan_Global.dbg:EnableDebug(false) -Titan_Global.dbg:EnableTopic("Tooltip", false) -Titan_Global.dbg:EnableTopic("Menu", false) diff --git a/Titan/TitanHistory.lua b/Titan/TitanHistory.lua index 3d9e42f..cf573af 100644 --- a/Titan/TitanHistory.lua +++ b/Titan/TitanHistory.lua @@ -15,6 +15,22 @@ Green - 'header' - Titan or plugin Highlight - notes. tips. and details --]] Titan_Global.recent_changes = "" +.. TitanUtils_GetGoldText("8.4.0 : 2025/09/07\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- Titan : \n" +.. "- - : /titan reset working again; no reload needed!\n" +.. "- - : Hopefully fix bar transparency values resetting on logout or reload.\n" +.. "- - : Moved most bar settings from 'Bars - All' to each bar - use profiles instead.\n" +.. "- --- Bar skin / color settings\n" +.. "- --- Hide Bar during combat\n" +.. "- --- Hide Bar in PvP and BG zones\n" +.. "- - : Per an API change in 11.2.0, disable drag & drop of Titan plugins for now..." +.. "- Internal : \n" +.. "- - : Global profiles should be working again.\n" +.. "- - : More debug statements on login, reload, profile reset.\n" +.. "- - : Removed code for old DewDrop and Tablet from tooltip code.\n" +) .. TitanUtils_GetGoldText("8.3.5 : 2025/08/27\n") .. TitanUtils_GetGreenText("Titan : \n") .. TitanUtils_GetHighlightText("" diff --git a/Titan/TitanLDB.lua b/Titan/TitanLDB.lua index f62e618..85d1ac1 100644 --- a/Titan/TitanLDB.lua +++ b/Titan/TitanLDB.lua @@ -14,14 +14,14 @@ LDB (libdatabroker) is a small library that enables an addon to hook into a 'dis The addon dev creates an LDB object which the lib places in storage accessible by lib:DataObjectIterator(). It also fires a "LibDataBroker_DataObjectCreated" callback. -LDB objects work by callbacks. +LDB objects work by callbacks. When an LDB addon changes one of its values, the lib fires a callback for the display addon. The LDB addon may declare scripts (tooltip, mouse clicks, etc.) per the spec for the display addon to use. --- Starting from Titan view On PLAYER_ENTERING_WORLD, Titan will use the iterator to wrap each LDB type addon into a Titan plugin. -Once done processing the known LDB objects, +Once done processing the known LDB objects, Titan registers for the callback to handle LDB objects created later or on demand. Titan registers for callbacks on text and icon updates - depending on the LDB type. @@ -115,7 +115,7 @@ local InCombatLockdown = _G.InCombatLockdown; -- Create control frame so we can get events local LDBToTitan = CreateFrame("Frame", "LDBTitan") local ldb = LibStub:GetLibrary("LibDataBroker-1.1") -local Tablet, LibQTip = nil, nil +local LibQTip = nil local media = LibStub("LibSharedMedia-3.0") -- generic icon in case the DO does not provide one local iconTitanDefault = "Interface\\PVPFrame\\PVP-ArenaPoints-Icon"; @@ -222,7 +222,7 @@ function LDBToTitan:TitanLDBSetTooltip(name, frame, tt_func) end ---Titan Script Handler for the Titan (LDB) plugin ---- This implementation will work fine for a static tooltip but may have implications for dynamic ones so for now, +--- This implementation will work fine for a static tooltip but may have implications for dynamic ones so for now, --- we'll only set it once (no callback) and see what happens ---@param event string Event name ---@param name string Plugin id name for LDB @@ -315,39 +315,19 @@ function LDBToTitan:TitanLDBHandleScripts(event, name, _, func, obj) else TitanPluginframe:SetScript("OnEnter", function(self) -- Check for tooltip libs without embedding them - if AceLibrary and AceLibrary:HasInstance("Tablet-2.0") then - Tablet = AceLibrary("Tablet-2.0") - end + + -- Dropped Ace Tablet-2.0 lib as of 2025 Sep; last updated 2008 Sep LibQTip = LibStub("LibQTip-1.0", true) -- Check to see if we allow tooltips to be shown if not TitanPanelGetVar("ToolTipsShown") or (TitanPanelGetVar("HideTipsInCombat") and InCombatLockdown()) then -- if a plugin is using tablet, then detach and close the tooltip - if Tablet and Tablet:IsRegistered(TitanPluginframe) - and Tablet:IsAttached(TitanPluginframe) then - Tablet:Detach(TitanPluginframe); - Tablet:Close(TitanPluginframe); - end return; else -- if a plugin is using tablet, then re-attach the tooltip -- (it will auto-open on mouseover) - if Tablet and Tablet:IsRegistered(TitanPluginframe) - and not Tablet:IsAttached(TitanPluginframe) then - Tablet:Attach(TitanPluginframe); - end - end - -- if a plugin is using tablet then set its transparency - -- and font size accordingly - if Tablet and Tablet:IsRegistered(TitanPluginframe) then - Tablet:SetTransparency(TitanPluginframe, TitanPanelGetVar("TooltipTrans")) - if not TitanPanelGetVar("DisableTooltipFont") then - Tablet:SetFontSizePercent(TitanPluginframe, TitanPanelGetVar("TooltipFont")) - elseif TitanPanelGetVar("DisableTooltipFont") - and Tablet:GetFontSizePercent(TitanPluginframe) ~= 1 then - Tablet:SetFontSizePercent(TitanPluginframe, 1) - end end + -- set original tooltip scale for GameTooltip if not TitanPanelGetVar("DisableTooltipFont") then TitanTooltipOrigScale = GameTooltip:GetScale(); @@ -502,12 +482,12 @@ function LDBToTitan:TitanLDBIconUpdate(_, name, attr, value, dataobj) TitanPlugins[name].icon = value; TitanPanelButton_SetButtonIcon(name); end - + -- support for iconCoords, iconR, iconG, iconB attributes if attr == "iconCoords" then TitanPanelButton_SetButtonIcon(name, value); end - + if attr == "iconR" or attr == "iconB" or attr == "iconG" then TitanPanelButton_SetButtonIcon(name, nil, dataobj.iconR, dataobj.iconG, dataobj.iconB); @@ -542,9 +522,7 @@ end ---@param obj table LDB data object function TitanLDBCreateObject(self, name_str, obj) local name = name_str - if Titan_Global.debug.ldb_setup then - TitanDebug(tostring(name) .. " : Attempting to register "); - end + Titan_Debug.Out('titan', 'ldb_setup', tostring(name) .. " : Attempting to register "); -- couple sanity checks -- if not obj or not name then @@ -554,9 +532,7 @@ function TitanLDBCreateObject(self, name_str, obj) local issue = "LDB request name " .. " '" .. tostring(name) .. "'" .. " unrecognizable !!!!" - if Titan_Global.debug.ldb_setup then - TitanDebug(issue); - end + Titan_Debug.Out('titan', 'ldb_setup', issue); error(issue) -- get out end if obj and type(obj) == 'table' then @@ -572,9 +548,7 @@ function TitanLDBCreateObject(self, name_str, obj) .. " '" .. tostring(name) .. "'" .. " " .. tostring(object) .. "" .. " !!!!" - if Titan_Global.debug.ldb_setup then - TitanDebug(issue); - end + Titan_Debug.Out('titan', 'ldb_setup', issue); error(issue) -- get out end @@ -595,9 +569,7 @@ function TitanLDBCreateObject(self, name_str, obj) -- Create enough of a plugin to tell the user / developer -- that this plugin failed miserably local issue = "Unsupported LDB type '" .. tostring(obj.type) .. "'" - if Titan_Global.debug.ldb_setup then - TitanDebug(TITAN_REGISTER_FAILED .. " " .. issue); - end + Titan_Debug.Out('titan', 'ldb_setup', TITAN_REGISTER_FAILED .. " " .. issue); error(issue) -- return TITAN_REGISTER_FAILED -- get out, there is nothing more that can be done end @@ -723,11 +695,9 @@ function TitanLDBCreateObject(self, name_str, obj) iconG = (obj.iconG or nil), }; - if Titan_Global.debug.ldb_setup then - TitanDebug("" - .. " type: '" .. tostring(registry.ldb) .. "' " - ) - end + Titan_Debug.Out('titan', 'ldb_setup', "" + .. " type: '" .. tostring(registry.ldb) .. "' " + ) -- Set the plugin category, if it exists, else default to "General" -- Per the 1.1 LDB spec we check for a tocname attrib first, @@ -791,11 +761,6 @@ function TitanLDBCreateObject(self, name_str, obj) SecureUnitButton_OnClick(self, button, down) --TitanPanelBarButton_OnClick(self, button) end) - if Titan_Global.debug.ldb_setup then - TitanDebug("" - .." macrotext cmd: '"..tostring(obj.commandtext).."' " - ) - end else newTitanFrame = CreateFrame("Button", TitanUtils_ButtonName(name), @@ -865,14 +830,12 @@ function TitanLDBCreateObject(self, name_str, obj) TitanVariables_SyncSinglePluginSettings(registry.id) TitanPanel_InitPanelButtons() -- Show it... end - if Titan_Global.debug.ldb_setup then - TitanDebug("LDB create" - .. " " .. tostring(pew) .. "" - .. " '" .. tostring(registry.id) .. "'" - .. " '" .. tostring(registry.ldb) .. "'" - .. "\n...'" .. tostring(newTitanFrame:GetName()) .. "'" - ) - end + Titan_Debug.Out('titan', 'ldb_setup', "LDB create" + .. " " .. tostring(pew) .. "" + .. " '" .. tostring(registry.id) .. "'" + .. " '" .. tostring(registry.ldb) .. "'" + .. "\n...'" .. tostring(newTitanFrame:GetName()) .. "'" + ) return "Success" end @@ -908,14 +871,12 @@ function LDBToTitan:TitanLDBCreateObject(sender, name, obj) TitanUtils_PluginFail(plugin) end - if Titan_Global.debug.ldb_setup then - TitanDebug("LDB Create:" - -- .." "..tostring(sender).."" - .. " " .. tostring(name) .. "" - .. " " .. tostring(call_success) .. "" - .. " " .. tostring(ret_val) .. "" - ) - end + Titan_Debug.Out('titan', 'ldb_setup', "LDB Create:" + -- .." "..tostring(sender).."" + .. " " .. tostring(name) .. "" + .. " " .. tostring(call_success) .. "" + .. " " .. tostring(ret_val) .. "" + ) end --- OnEvent - PLAYER_LOGIN - handler for LDBToTitan @@ -954,13 +915,11 @@ LDBToTitan:SetScript("OnEvent", function(self, event, ...) TitanUtils_PluginFail(plugin) end - if Titan_Global.debug.ldb_setup then - TitanDebug("LDB" - .. " " .. tostring(name) .. "" - .. " " .. tostring(call_success) .. "" - .. " " .. tostring(ret_val) .. "" - ) - end + Titan_Debug.Out('titan', 'ldb_setup', "LDB" + .. " " .. tostring(name) .. "" + .. " " .. tostring(call_success) .. "" + .. " " .. tostring(ret_val) .. "" + ) end -- In case a LDB plugin is created later... diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index 4a0d71c..55037ea 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -447,9 +447,7 @@ local function MoveFrame(frame_ptr, start_y, top_bottom, force) -- Should note get here... dbg = dbg.." No frame ??" end - if Titan_Global.debug.movable then - TitanDebug(dbg) - end + Titan_Debug.Out('titan', 'movable', dbg) end --[[ local @@ -746,9 +744,7 @@ local function TitanMovableFrame_MoveFrames(force) if InCombatLockdown() then -- nothing to do else - if Titan_Global.debug.movable then - TitanDebug("Start frame adjust...") - end + Titan_Debug.Out('titan', 'movable', "Start frame adjust...") for i = 1,#MData,1 do local dbg = "Mv" local ok = false @@ -761,9 +757,7 @@ local function TitanMovableFrame_MoveFrames(force) dbg = dbg.." move" ok = true end - if Titan_Global.debug.movable then - TitanDebug(dbg) - end + Titan_Debug.Out('titan', 'movable', dbg) if ok then -- Adjust the frame per MData MData[i].move(force) @@ -784,9 +778,7 @@ local function TitanMovableFrame_MoveFrames(force) end Titan_FCF_UpdateDockPosition(); -- chat UpdateContainerFrameAnchors(); -- Move bags as needed - if Titan_Global.debug.movable then - TitanDebug("...End frame adjust") - end + Titan_Debug.Out('titan', 'movable', "...End frame adjust") end end @@ -808,9 +800,7 @@ function TitanPanel_AdjustFrames(force, reason) -- such as when the user has just de/selected top or bottom bars local f = force or false -- do not require the parameter local str = reason or "?" - if Titan_Global.debug.movable then - TitanDebug("Adj: "..str) - end + Titan_Debug.Out('titan', 'movable', "Adj: "..str) -- Adjust frame positions top and bottom based on user choices if hooks_done then TitanMovableFrame_MoveFrames(f) diff --git a/Titan/TitanTemplate.lua b/Titan/TitanTemplate.lua index a8c158c..e7483dc 100644 --- a/Titan/TitanTemplate.lua +++ b/Titan/TitanTemplate.lua @@ -63,8 +63,14 @@ local TITAN_PANEL_BUTTON_TYPE_ICON = 2; local TITAN_PANEL_BUTTON_TYPE_COMBO = 3; local TITAN_PANEL_BUTTON_TYPE_CUSTOM = 4; local pluginOnEnter = nil; + +-- Used for drag and drop, assuming one can only drag one plugin :) local TITAN_PANEL_MOVE_ADDON = ""; local TITAN_PANEL_DROPOFF_ADDON = ""; +local Drag_init = {} +local drag = Drag_init +local FROM_BAR_SHORT = "" +local FROM_BAR_FRAME = "" -- Library instances local LibQTip = nil @@ -140,7 +146,7 @@ end ---@param xOffset number X offset ---@param yOffset number Y offset ---@param frame table Tooltip frame ---- Set Titan_Global.debug.tool_tips to output debug +--- Set Titan_Debug.titan.tool_tips to output debug local function TitanTooltip_SetOwnerPosition(parent, anchorPoint, relativeToFrame, relativePoint, xOffset, yOffset, frame) -- Changes for 9.1.5 Removed the background template from the GameTooltip -- Making changes to it difficult and possibly changing the tooltip globally. @@ -159,20 +165,18 @@ local function TitanTooltip_SetOwnerPosition(parent, anchorPoint, relativeToFram frame:SetScale(TitanPanelGetVar("TooltipFont")); end - if Titan_Global.debug.tool_tips then local dbg_msg = "_pos" .. " '" .. tostring(frame:GetName()) .. "'" .. " " .. tostring(frame:IsShown()) .. "" .. " @ '" .. tostring(relativeToFrame) .. "'" .. " " .. tostring(_G[relativeToFrame]:IsShown()) .. "" - TitanDebug(dbg_msg, "normal") + Titan_Debug.Out('titan', 'tool_tips', dbg_msg) dbg_msg = ">>_pos" .. " " .. tostring(anchorPoint) .. "" .. " " .. tostring(relativePoint) .. "" .. " w" .. tostring(format("%0.1f", frame:GetWidth())) .. "" .. " h" .. tostring(format("%0.1f", frame:GetHeight())) .. "" - TitanDebug(dbg_msg, "normal") - end + Titan_Debug.Out('titan', 'tool_tips', dbg_msg) end ---local Helper to set the screen position of the tooltip frame @@ -211,7 +215,7 @@ end ---local Set the tooltip (GameTooltip) of the given Titan plugin. ---@param self table Plugin frame ---- Set Titan_Global.debug.tool_tips to output debug of this routine +--- Set Titan_Debug.titan.tool_tips to output debug of this routine local function TitanPanelButton_SetTooltip(self) local dbg_msg = "TT:" local ok = false @@ -333,9 +337,7 @@ local function TitanPanelButton_SetTooltip(self) -- no need to waste cycles end - if Titan_Global.debug.tool_tips then - TitanDebug(dbg_msg, "normal") - end + Titan_Debug.Out('titan', 'tool_tips', dbg_msg) end ---local Is the given Titan plugin template type text? @@ -381,10 +383,28 @@ end --- Set TITAN_PANEL_MOVING so any Titan routine will know a 'drag & drop' is in progress. --- Set TITAN_PANEL_MOVE_ADDON so sanity checks can be done on the 'drop'. local function TitanPanelButton_OnDragStart(self) - if TitanPanelGetVar("LockButtons") or InCombatLockdown() then return end + -- Due to API change in 11.2.0, :ClearAllPoints with also clear all plugins from Titan bar... + -- Dropped Ace Dewdrop-2.0 lib as of 2025 Sep; last updated 2008 Sep + -- Dropped Ace Tablet-2.0 lib as of 2025 Sep; last updated 2009 Jan (marked as abandoned) - local frname = self; + if TitanPanelGetVar("LockButtons") or InCombatLockdown() then + return -- not requested or not allowed + else + -- Proceed + end + local frname = self + local frstr = self:GetName() + local plugin_id = TitanUtils_GetButtonID(frstr) + -- See if the plugin is supposed to stay on the bar it is on + if TitanGetVar(plugin_id, "ForceBar") then + return -- not allowed + else + -- Proceed + end + + +--[[ -- Clear button positions or we'll grab the button and all buttons 'after' for i, j in pairs(TitanPanelSettings.Buttons) do local pluginid = _G[TitanUtils_ButtonName(TitanPanelSettings.Buttons[i])]; @@ -392,20 +412,26 @@ local function TitanPanelButton_OnDragStart(self) pluginid:ClearAllPoints() end end +--]] + + FROM_BAR_SHORT = TitanUtils_GetWhichBar(plugin_id) -- short name + local str = "" + str = "_OnDragStart start " + .." "..tostring(plugin_id).."" + .." from "..tostring(FROM_BAR_SHORT).."" + Titan_Debug.Out('titan', 'plugin_drag_drop', str) + + -- Clear the plugin placement so we only move the intended plugin +-- frname:ClearAllPoints() + FROM_BAR_FRAME = TitanVariables_GetFrameName(FROM_BAR_SHORT) + TitanPanel_RemoveButton(plugin_id) -- Start the drag; close any tooltips and open control frames frname:StartMoving(); frname.isMoving = true; TitanUtils_CloseAllControlFrames(); TitanPanelRightClickMenu_Close(); - if AceLibrary then - if AceLibrary:HasInstance("Dewdrop-2.0") then - AceLibrary("Dewdrop-2.0"):Close() - end - if AceLibrary:HasInstance("Tablet-2.0") then - AceLibrary("Tablet-2.0"):Close() - end - end + GameTooltip:Hide(); -- LibQTip-1.0 support code LibQTip = LibStub("LibQTip-1.0", true) @@ -414,7 +440,7 @@ local function TitanPanelButton_OnDragStart(self) for key, tip in LibQTip:IterateTooltips() do if tip then local _, relativeTo = tip:GetPoint() - if relativeTo and relativeTo:GetName() == self:GetName() then + if relativeTo and relativeTo:GetName() == frstr then tip:Hide() break end @@ -424,13 +450,17 @@ local function TitanPanelButton_OnDragStart(self) -- /LibQTip-1.0 support code -- Hold the plugin id so we can do checks on the drop - TITAN_PANEL_MOVE_ADDON = TitanUtils_GetButtonID(self:GetName()); + TITAN_PANEL_MOVE_ADDON = plugin_id -- Tell Titan that a drag & drop is in process TITAN_PANEL_MOVING = 1; -- Store the OnEnter handler so the tooltip does not show - or other oddities pluginOnEnter = self:GetScript("OnEnter") self:SetScript("OnEnter", nil) + + str = "_OnDragStart moving " + .." "..tostring(self:GetName()).."" + Titan_Debug.Out('titan', 'plugin_drag_drop', str) end ---local Handle the OnDragStop event of the given Titan plugin. @@ -442,6 +472,12 @@ local function TitanPanelButton_OnDragStop(self) if TitanPanelGetVar("LockButtons") then return end + + local str = "" + str = "_OnDragStop start " + .." "..tostring(self:GetName()).."" + Titan_Debug.Out('titan', 'plugin_drag_drop', str) + local ok_to_move = true local nonmovableFrom = false; local nonmovableTo = false; @@ -457,10 +493,8 @@ local function TitanPanelButton_OnDragStop(self) ok_to_move = false end - -- eventually there could be several reasons to not allow - -- the plugin to move + -- There could be several reasons to not allow the plugin to move if ok_to_move then - local i, j; for i, j in pairs(TitanPanelSettings.Buttons) do local pluginid = _G[TitanUtils_ButtonName(TitanPanelSettings.Buttons[i])]; @@ -491,10 +525,12 @@ local function TitanPanelButton_OnDragStop(self) end if tbar then - TitanPanel_RemoveButton(TITAN_PANEL_MOVE_ADDON) +-- TitanPanel_RemoveButton(TITAN_PANEL_MOVE_ADDON) TitanUtils_AddButtonOnBar(TitanBarData[tbar].name, TITAN_PANEL_MOVE_ADDON) else -- not sure what the user did... + -- Likely released on UI so put back on the bar it came from + TitanUtils_AddButtonOnBar(FROM_BAR_SHORT, TITAN_PANEL_MOVE_ADDON) end else -- plugin was dropped on another plugin - swap (for now) @@ -515,6 +551,14 @@ local function TitanPanelButton_OnDragStop(self) end end + str = "_OnDragStop " + .." "..tostring(self:GetName()).."" + .." ok:"..tostring(ok_to_move).."" + .." no from:"..tostring(nonmovableFrom).."" + .." no to:"..tostring(nonmovableTo).."" + .." Over:"..tostring(TITAN_PANEL_DROPOFF_ADDON).."" + Titan_Debug.Out('titan', 'plugin_drag_drop', str) + -- This is important! The start drag cleared the button positions so -- the buttons need to be put back properly. TitanPanel_InitPanelButtons(); @@ -523,6 +567,7 @@ local function TitanPanelButton_OnDragStop(self) -- Restore the OnEnter script handler if pluginOnEnter then self:SetScript("OnEnter", pluginOnEnter) end pluginOnEnter = nil; + end end @@ -861,9 +906,7 @@ local function TitanPanelButton_SetButtonText(id) -- no valid routine to update the plugin text dbg_msg = dbg_msg .. " | no valid routine found" end - if Titan_Global.debug.plugin_text then - TitanDebug(dbg_msg, "normal") - end + Titan_Debug.Out('titan', 'plugin_text', dbg_msg) end ---local Set the width of the given Titan plugin - text only. diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 8fbaf10..8efa14c 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -1940,14 +1940,11 @@ If someone where to start creating Titan frames after the registration process w notes = notes, } - -- Debug - if Titan_Global.debug.plugin_register then - TitanDebug("Queue Plugin" + Titan_Debug.Out('titan', 'plugin_register', "Queue Plugin" -- .." '"..tostring(self:GetName()).."'" .. " '" .. tostring(TitanUtils_GetButtonID(self:GetName())) .. "'" .. " " .. tostring(TITAN_NOT_REGISTERED) .. "" ) - end end ---local Handle a Titan plugin that could not be registered. @@ -2023,7 +2020,7 @@ NOTE: local notes = "" local str = "" - local self = plugin.self + local self = plugin.self -- plugin frame reference if self and self:GetName() then -- Check for the .registry where all the Titan plugin info is expected @@ -2084,9 +2081,10 @@ NOTE: if (plugin_id) then self:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp"); self:RegisterForDrag("LeftButton") - if (plugin_id.id) then - TitanPanelDetectPluginMethod(plugin_id.id); - end +-- Per an API change in 11.2.0, disable drag & drop for now... +-- if (plugin_id.id) then +-- TitanPanelDetectPluginMethod(plugin_id.id); +-- end end result = TITAN_REGISTERED -- determine the plugin category @@ -2120,16 +2118,14 @@ NOTE: issue = "Can not determine plugin button name" end - -- Debug - if Titan_Global.debug.plugin_register then - TitanDebug("Plugin RegProt" + Titan_Debug.Out('titan', 'plugin_register', "Plugin RegProt" -- .." '"..tostring(self:GetName()).."'" .. " '" .. tostring(id) .. "'" .. " '" .. tostring(result) .. "'" .. " '" .. tostring(str) .. "'" .. " '" .. tostring(TitanPlugins[id].id) .. "'" ) - end + -- create and return the results local ret_val = {} ret_val.issue = (issue or "") @@ -2194,14 +2190,10 @@ function TitanUtils_RegisterPlugin(plugin) , "error") end - -- Debug - if Titan_Global.debug.plugin_register then - local status = plugin.status - TitanDebug("Registering Plugin" + Titan_Debug.Out('titan', 'plugin_register', "Registering Plugin" .. " " .. tostring(plugin.name) .. "" - .. " " .. tostring(status) .. "" + .. " " .. tostring(plugin.status) .. "" ) - end end end @@ -2257,7 +2249,7 @@ end --- Old "TitanPanelRightClickMenu_Prepare"..plugin_id.."Menu" --- New : .menuTextFunction in registry --- UIDropDownMenu_Initialize will place (part of) the error in the menu - it is not progagated out. ---- Set Titan_Global.debug.menu to output the error to Chat. +--- Set Titan_Debug.titan.menu to output the error to Chat. local function TitanRightClickMenu_OnLoad(self, menu) --[[ - The function to create the menu is either @@ -2317,13 +2309,11 @@ local function TitanRightClickMenu_OnLoad(self, menu) end end - if Titan_Global.debug.menu then if err == "" then -- all is good else - TitanDebug(err, "error") + Titan_Debug.Out('titan', 'menu', "Error: "..err) end - end -- Under the cover the menu is built as DropDownList1 -- return DropDownList1, DropDownList1:GetHeight(), DropDownList1:GetWidth() return menu, menu:GetHeight(), menu:GetWidth() @@ -2740,23 +2730,22 @@ function TitanArgConvert(event, a1, a2, a3, a4, a5, a6) ) end ----Titan: Output a given table; up to a depth of 8 levels. +---Titan: Output a given table; up to a depth of 8 levels. Can generate A LOT of output! ---@param tb table ---@param level integer? 1 or defaults to 1 function TitanDumpTable(tb, level) - level = level or 1 - local spaces = string.rep(' ', level * 2) - for k, v in pairs(tb) do - if type(v) ~= "table" then - print("[" .. level .. "]v'" .. spaces .. "[" .. tostring(k) .. "]='" .. tostring(v) .. "'") - else - print("[" .. level .. "]t'" .. spaces .. "[" .. tostring(k) .. "]") - level = level + 1 - if level <= 8 then - TitanDumpTable(v, level) - end - end - end + level = level or 1 + local spaces = string.rep(' ', level) + for k, v in pairs(tb) do + if type(v) == "table" then + print("[" .. level .. "]" .. spaces .. "[" .. tostring(k) .. "]" .. " "..type(v)) + if level <= 8 then + TitanDumpTable(v, level+1) + end + else + print("[" .. level .. "]" ..spaces .. "[" .. tostring(k) .. "]='" .. tostring(v) .. "' "..type(v)) + end + end end ---Titan: From a given table; find input in its indexes. diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index 1742ed7..a43d491 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -341,6 +341,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Bar2"] = { off_x = 0, @@ -353,6 +354,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "AuxBar2"] = { off_x = 0, @@ -365,6 +367,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "AuxBar"] = { off_x = 0, @@ -377,6 +380,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short01"] = { off_x = x_mid, @@ -389,6 +393,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short02"] = { off_x = x_mid, @@ -401,6 +406,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short03"] = { off_x = x_mid, @@ -413,6 +419,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short04"] = { off_x = x_mid, @@ -425,6 +432,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short05"] = { off_x = x_mid, @@ -437,6 +445,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short06"] = { off_x = x_mid, @@ -449,6 +458,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short07"] = { off_x = x_mid, @@ -461,6 +471,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short08"] = { off_x = x_mid, @@ -473,6 +484,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short09"] = { off_x = x_mid, @@ -485,6 +497,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, [TITAN_PANEL_DISPLAY_PREFIX .. "Short10"] = { off_x = x_mid, @@ -497,6 +510,7 @@ TitanBarVarsDefaults = { auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER hide_in_combat = false, + hide_in_pvp = false, }, } @@ -569,8 +583,8 @@ TITAN_PANEL_SAVED_VARIABLES = { VersionShown = 1, ToolTipsShown = 1, HideTipsInCombat = false, - HideBarsInCombat = false, - HideBarsInPVP = false, +-- HideBarsInCombat = false, -- removed for 8.4.0 Sep 2025 +-- HideBarsInPVP = false, -- removed for 8.4.0 Sep 2025 -- Classic ScreenAdjust = false, AuxScreenAdjust = false, @@ -747,11 +761,12 @@ print("plugins init" local id = default_plugin.id local loc = default_plugin.loc local plugin = TitanUtils_GetPlugin(id) - --TitanDebug("Plugin: "..tostring(id).." "..(plugin and "T" or "F")) +-- TitanDebug("Plugin: "..tostring(id).." "..(plugin and "T" or "F")) -- See if plugin is registered if (plugin) then - --TitanDebug("__Plugin: "..tostring(id).." "..tostring(loc)) +-- TitanDebug("__Plugin: "..tostring(id).." "..tostring(loc)) -- Synchronize registered and saved variables + TitanPluginSettings[id] = {} TitanVariables_SyncRegisterSavedVariables( plugin.savedVariables, TitanPluginSettings[id]) TitanUtils_AddButtonOnBar(loc, id) @@ -930,13 +945,13 @@ end --- Called when Titan is loaded (ADDON_LOADED event) function TitanVariables_InitTitanSettings() local player = TitanUtils_GetPlayer() - Titan_Global.dbg:Out("Menu", "_Init begin " .. tostring(player)) + Titan_Debug.Out('titan', 'profile', "_Init begin " .. tostring(player)) if (TitanSettings) then -- all is good else TitanSettings = {} - Titan_Global.dbg:Out("Menu", "TitanSettings {}") + Titan_Debug.Out('titan', 'profile', "TitanSettings {}") end -- check for player list per issue #745 @@ -944,7 +959,7 @@ function TitanVariables_InitTitanSettings() -- all is good else TitanSettings.Players = {} -- empty saved vars. New install or wipe - Titan_Global.dbg:Out("Menu", "TitanSettings.Players {}") + Titan_Debug.Out('titan', 'profile', "TitanSettings.Players {}") end if (TitanAll) then @@ -953,11 +968,11 @@ function TitanVariables_InitTitanSettings() TitanAll = {} end - Titan_Global.dbg:Out("Menu", "Sync Titan Panel saved variables with TitanAll") + Titan_Debug.Out('titan', 'profile', "Sync Titan Panel saved variables with TitanAll") TitanVariables_SyncRegisterSavedVariables(TITAN_ALL_SAVED_VARIABLES, TitanAll) - Titan_Global.dbg:Out("Menu", "> Sync Done") + Titan_Debug.Out('titan', 'profile', "> Sync Done") - Titan_Global.dbg:Out("Menu", "_Init end " .. tostring(player)) + Titan_Debug.Out('titan', 'profile', "_Init end " .. tostring(player)) -- Current Titan list known - all toons player has profiles for -- Sort in alphabetical order. @@ -1051,11 +1066,21 @@ end ---@param to_profile string --- If no profile found, use Titan defaults local function Set_bar_vars(to_profile) + local str = "" -- for debug output + if TitanSettings.Players[to_profile].BarVars then -- All good - Titan_Global.dbg:Out("Menu", "Set_bar_vars found") + -- build debug output + str = "Set_bar_vars found" + .." "..tostring(to_profile).."" + Titan_Debug.Out('titan', 'profile', str) else - Titan_Global.dbg:Out("Menu", "Set_bar_vars init") + -- Likely a new toon or new to Titan so just get defaults. + -- build debug output + str = "Set_bar_vars init" + .." "..tostring(to_profile).."" + Titan_Debug.Out('titan', 'profile', str) + -- Set to defaults TitanSettings.Players[to_profile].BarVars = TitanBarVarsDefaults local BV = TitanSettings.Players[to_profile].BarVars @@ -1064,10 +1089,8 @@ local function Set_bar_vars(to_profile) local panel = TitanSettings.Players[to_profile].Panel local tex = panel["TexturePath"]:gsub("TitanClassic", "Titan") -- hold over, just in case... - Titan_Global.dbg:Out("Menu", "tex path '" .. tex .. "'") + Titan_Debug.Out('titan', 'profile', "tex path '" .. tex .. "'") - -- Bring original Titan bar optionss to the current user settings. - -- If this is a new toon or new saved vars then it will just get defaults. for idx, v in pairs(TitanBarData) do if v.user_move == false then -- Set original Bar options from the 'old' saved vars location @@ -1103,24 +1126,36 @@ local function Init_player_settings(from_profile, to_profile, action) From: saved variables of that profile To: Player or Global profile --]] + local str = "" -- for debug output local old_player = {} local old_panel = {} local old_plugins = {} local reset = (action == TITAN_PROFILE_RESET) - local msg = "Init_player_settings" - .. " from: " .. tostring(from_profile) .. "" - .. " to: " .. tostring(to_profile) .. "" - .. " action: " .. tostring(action) .. "" - Titan_Global.dbg:Out("Menu", msg) + str = "Init_player_settings" + .. " from: " .. tostring(from_profile) .. "" + .. " to: " .. tostring(to_profile) .. "" + .. " action: " .. tostring(action) .. "" + Titan_Debug.Out('titan', 'profile', str) CleanupProfile() -- hide currently shown plugins - if TitanSettings.Players[to_profile] then - -- all is good + if reset then + -- ensure the rpofile is rebuilt with defaults + TitanSettings.Players[to_profile] = nil else + -- proceed + end + + -- === Ensure we have a place to store profile, could be new toon or new install + if TitanSettings.Players[to_profile] == nil + or TitanSettings.Players[to_profile] == {} then + -- build debug output + str = "Init_player_settings" + .." "..tostring("TitanSettings.Players[] {}").."" + Titan_Debug.Out('titan', 'profile', str) + -- Create the bare player tables so profile(s) can be added - Titan_Global.dbg:Out("Menu", "TitanSettings.Players[] {}") TitanSettings.Players[to_profile] = {} TitanSettings.Players[to_profile].Plugins = {} TitanSettings.Players[to_profile].Panel = TITAN_PANEL_SAVED_VARIABLES @@ -1132,12 +1167,19 @@ local function Init_player_settings(from_profile, to_profile, action) TitanPlayerSettings["Register"] = {} TitanPlayerSettings["BarVars"] = TitanBarVarsDefaults -- New Mar 2023 TitanPlayerSettings["Adjust"] = {} -- New May 2023 + else + -- all is good + -- build debug output + str = "Init_player_settings" + .." "..tostring("TitanSettings.Players[] ").."" + .." "..tostring(to_profile).."" + Titan_Debug.Out('titan', 'profile', str) end -- Set global variables TitanPlayerSettings = TitanSettings.Players[to_profile]; TitanPluginSettings = TitanPlayerSettings["Plugins"]; TitanPanelSettings = TitanPlayerSettings["Panel"]; - TitanVariables_SyncRegisterSavedVariables(TITAN_PANEL_SAVED_VARIABLES, TitanPanelSettings) + TitanVariables_SyncRegisterSavedVariables(TitanBarVarsDefaults, TitanPlayerSettings["BarVars"]) -- ====== New May 2023 : Back to adjusting a couple frames per user settings -- Could be new toon / ... @@ -1157,6 +1199,8 @@ local function Init_player_settings(from_profile, to_profile, action) -- ====== New Mar 2023 : TitanSettings.Players[player].BarData to hold Short bar data Set_bar_vars(to_profile) -- ====== + + -- === if action == TITAN_PROFILE_RESET then -- default is global profile OFF TitanAll = {} @@ -1180,14 +1224,14 @@ local function Init_player_settings(from_profile, to_profile, action) Set_bar_vars(from_profile) TitanSettings.Players[to_profile]["BarVars"] = deepcopy(old_player["BarVars"]) --[[ - if Titan_Global.dbg:EnableTopic("Menu") then + if Titan_Global.titan.profile then -- Apply the new bar positions for idx, v in pairs(TitanBarData) do local str = "BarVars " .. " " .. tostring(v.name) .. "" .. " " .. tostring(TitanSettings.Players[from_profile]["BarVars"][idx].show) .. "" .. " " .. tostring(TitanSettings.Players[to_profile]["BarVars"][idx].show) .. "" - Titan_Global.dbg:Out("Menu", str) + Titan_Debug.Out('titan', 'profile', str) end end --]] @@ -1206,8 +1250,16 @@ local function Init_player_settings(from_profile, to_profile, action) end TitanBarDataVars = TitanPlayerSettings["BarVars"] -- works here, after setting BarVars + -- build debug output + str = "Init_player_settings" + .." "..tostring("BarVars now set").."" + Titan_Debug.Out('titan', 'profile', str) if (TitanPlayerSettings) then + -- build debug output + str = "Init_player_settings" + .." "..tostring("_SyncPluginSettings").."" + Titan_Debug.Out('titan', 'profile', str) -- Synchronize plugin settings with plugins that were registered TitanVariables_SyncPluginSettings() -- Display the plugins the user selected AND are registered @@ -1392,19 +1444,29 @@ end ---@param profile? string name ---@param action string Use | Reset function TitanVariables_UseSettings(profile, action) + local str = "" -- for debug output if requested + local _ = nil -- for scope; do not care about this value + local from_profile = nil - if action == TITAN_PROFILE_USE then + if action == TITAN_PROFILE_USE then -- needed? -- Grab the old profile currently in use from_profile = profile or nil end - local _ = nil local glob, name, player, server = TitanUtils_GetGlobalProfile() - -- Get the profile according to the user settings - if glob then - profile = name -- Use global toon + + -- Get the profile according to the user settings and choices + if action == TITAN_PROFILE_RESET then + -- Use current toon; reset will clear global for ALL toons + profile, _, _ = TitanUtils_GetPlayer() else - profile, _, _ = TitanUtils_GetPlayer() -- Use current toon + if glob then + -- Use global toon per user setting + profile = name + else + -- Use current toon; each toon is unique + profile, _, _ = TitanUtils_GetPlayer() + end end -- Find the profile in a case insensitive manner @@ -1423,13 +1485,27 @@ function TitanVariables_UseSettings(profile, action) end -- Now that we know what profile to use - act on the data + -- build debug output + str = "_UseSettings" + .." "..tostring(action).."" + .." from '"..tostring(from_profile).."'" + .." to '"..tostring(new_profile).."'" + Titan_Debug.Out('titan', 'profile', str) Init_player_settings(from_profile, new_profile, action) -- set strata in case it has changed TitanVariables_SetPanelStrata(TitanPanelGetVar("FrameStrata")) -- show the new profile + -- build debug output + str = "...init bars" + .." "..tostring(action).."" + Titan_Debug.Out('titan', 'profile', str) TitanPanel_InitPanelBarButton("UseSettings"); + -- build debug output + str = "...init plugins on bars" + .." "..tostring(action).."" + Titan_Debug.Out('titan', 'profile', str) TitanPanel_InitPanelButtons(); end diff --git a/Titan/_TitanIDE.lua b/Titan/_TitanIDE.lua index d43df56..6b4aa02 100644 --- a/Titan/_TitanIDE.lua +++ b/Titan/_TitanIDE.lua @@ -88,7 +88,7 @@ TitanPanelXPButtonIcon = {} --====== Libs that may exist or adjusting for libs AceLibrary = {} -Tablet20Frame = {} + ---@class AceAddon AceHook = {} @@ -128,11 +128,18 @@ C_Bank = {} -- 11.0.0 New Warbank - Hopefully WoW API extension will catch up so -- Lua allows table updates but the IDE complains about 'injecting' a field it does not know about. -- Adding a function or variable to a frame in this case. +---@class UIParent WoW frame +---@field GetScale function WoW region routine + ---@class Frame frame for a Titan template ---@field showTimer number time to close in seconds ---@field isCounting number | nil 1 or nil ---@field parent table | nil Anchor tooltip +--====== Plugin frames from Template XML +-- These fields are used by Titan to store plugin info. +-- This can avoid 'convoluted' lookups and be faster. +-- ---@class Button Plugin frame from a Titan template ---@field TitanLDBSetOwnerPosition function Anchor tooltip ---@field TitanLDBSetTooltip function Fill tooltip @@ -147,11 +154,6 @@ C_Bank = {} -- 11.0.0 New Warbank - Hopefully WoW API extension will catch up so ---@field bar_name string Used by auto hide built-in ---@field registry table Any Titan plugin (built-in; third party; or LDB) ---@field tooltipText string Titan text for the tool tip - ----@class UIParent WoW frame ----@field GetScale function WoW region routine - ----@class Button Plugin frame ---@field RequestTimePlayed table Override default - XP ---@field TIME_PLAYED_MSG table Override default - XP ---@field short_name string Placeholder for short bar name diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua index 321b1e3..9581fc6 100644 --- a/TitanGold/TitanGold.lua +++ b/TitanGold/TitanGold.lua @@ -45,10 +45,10 @@ local FACTION_HORDE = "Horde_debug" --]] -- Topic debug tool / scheme -local dbg = Titan_Debug:New(TITAN_GOLD_ID) -dbg:EnableDebug(false) -dbg:EnableTopic("Events", false) -dbg:EnableTopic("Flow", false) +Titan_Debug.gold = {} +Titan_Debug.gold.events = false +Titan_Debug.gold.flow = false +Titan_Debug.gold.tooltip = false -- ******************************** Functions ******************************* @@ -673,7 +673,7 @@ local function GetTooltipText() .. war_name .. "\t" .. cash local msg = "" .. war_name .. " ".. cash - dbg:Out("Tooltip", msg) + Titan_Debug.Out('gold', 'tooltip', msg) end @@ -798,7 +798,7 @@ end ---local See if this toon is in saved vars AFTER PEW event. --- Get current total and session start time. Toon gold is available via API AFTER PEW event. local function Initialize_Array() - dbg:Out("Flow", "Init inititated") + Titan_Debug.Out('gold', 'flow', "Init inititated") local info = "" if (GOLD_INITIALIZED) then @@ -851,10 +851,10 @@ local function Initialize_Array() .." "..tostring(Warband.GetSum()).."" end - local msg = "" + local msg = ">Init done : " .." "..tostring(GOLD_INITIALIZED).."" .." "..info.."" - dbg:Out("Flow", ">Init done : "..msg) + Titan_Debug.Out('gold', 'flow', msg) end ---local Clear the gold array and rebuild @@ -1279,7 +1279,7 @@ local function OnShow(self) local msg = "" .." "..Gold_debug("OnShow") - dbg:Out("Flow", msg) + Titan_Debug.Out('gold', 'flow', msg) end ---local When shown, unregister needed events and stop timer for gold per hour @@ -1319,7 +1319,7 @@ local function OnEvent(self, event, a1, ...) end end - dbg:Out("Events", event) + Titan_Debug.Out('gold', 'events', event) end ---Button clicks - only shift-left for now diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua index f3d9ab4..63fb9e7 100755 --- a/TitanLocation/TitanLocation.lua +++ b/TitanLocation/TitanLocation.lua @@ -26,11 +26,10 @@ local LocationTimer = {}; local LocationTimerRunning = false -- Topic debug tool / scheme -local dbg = Titan_Debug:New(TITAN_LOCATION_ID) -dbg:EnableDebug(false) -dbg:AddTopic("Map") -dbg:EnableTopic("Events", false) -dbg:EnableTopic("Flow", false) +Titan_Debug.location = {} +Titan_Debug.location.events = false +Titan_Debug.location.flow = false +Titan_Debug.location.map = false local place = { @@ -89,7 +88,7 @@ local function Events(action, reason) local msg = "" .. " " .. tostring(action) .. "" .. " " .. tostring(reason) .. "" - dbg:Out("Events", msg) + Titan_Debug.Out('location', 'events', msg) end ---local Get the player coordinates on x,y axis of the map of the zone / area they are in. @@ -279,7 +278,7 @@ local msg = "" .. " " .. (format("%.2f", (bottom + height) or 0)) .. "]" .. " " .. (format("%.2f", cx)) .. "" .. " " .. (format("%.2f", cy)) .. "" - dbg:Out("Map", msg) + Titan_Debug.Out('location', 'map', msg) --]] end @@ -292,7 +291,7 @@ local msg = "" local msg = "" .. " " .. tostring(playerLocationText) .. "" .. " " .. tostring(cursorLocationText) .. "" - dbg:Out("Map", msg) + Titan_Debug.Out('location', 'map', msg) SetCoordText(playerLocationText, cursorLocationText) end @@ -358,7 +357,7 @@ local function CoordFrames(action) .. " " .. tostring(action) .. "" .. " " .. tostring(place.show_on_map) .. "" .. " " .. tostring(addon_conflict) .. "" - dbg:Out("Flow", msg) + Titan_Debug.Out('location', 'flow', msg) end ---local Adds player and cursor coords to the WorldMapFrame, unless the player has CT_MapMod @@ -375,7 +374,7 @@ local function CreateMapFrames() local msg = "CreateMapFrames" - dbg:Out("Flow", msg) + Titan_Debug.Out('location', 'map', msg) -- create the frame to hold the font strings, and simulate an "OnUpdate" script handler using C_Timer for efficiency local frame = CreateFrame("FRAME", TITAN_MAP_FRAME, WorldMapFrame) @@ -395,7 +394,7 @@ end local function OnShow(self) local msg = "_OnShow" - dbg:Out("Flow", msg) + Titan_Debug.Out('location', 'flow', msg) if LocationTimerRunning then -- Do not schedule a new one @@ -574,7 +573,7 @@ local function OnEvent(self, event, ...) local msg = "_OnEvent" .. " " .. tostring(event) .. "" - dbg:Out("Events", msg) + Titan_Debug.Out('location', 'events', msg) ZoneUpdate(self); --[[ @@ -812,9 +811,7 @@ local function OnLoad(self) } }; - local msg = - "_OnLoad" - dbg:Out("Flow", msg) + Titan_Debug.Out('location', 'flow', "_Onload") end ---local Create needed frames