diff --git a/Titan/Titan.lua b/Titan/Titan.lua index a2b8d77..df47219 100644 --- a/Titan/Titan.lua +++ b/Titan/Titan.lua @@ -363,11 +363,11 @@ function TitanPanel_PlayerEnteringWorld(reload) Titan__InitializedPEW = true -- Move frames - if TITAN_ID == "TitanClassic" then + if Titan_Global.switch.can_edit_ui then + -- No need + else TitanMovable_SecureFrames() TitanPanel_AdjustFrames(true, "_PlayerEnteringWorld") - else - -- No need end -- Loop through the LDB objects to sync with their created Titan plugin @@ -460,11 +460,11 @@ function TitanPanelBarButton:CVAR_UPDATE(cvarname, cvarvalue) or cvarname == "uiScale" then if TitanPlayerSettings and TitanPanelGetVar("Scale") then TitanPanel_InitPanelBarButton("CVAR_ " .. tostring(cvarname)) - if TITAN_ID == "TitanClassic" then + if Titan_Global.switch.can_edit_ui then + -- No need + else -- Adjust frame positions TitanPanel_AdjustFrames(true, "CVAR_UPDATE Scale") - else - -- No need end end end @@ -516,11 +516,11 @@ function TitanPanelBarButton:PLAYER_REGEN_ENABLED() in_combat = false TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_ENABLED") - if TITAN_ID == "TitanClassic" then + if Titan_Global.switch.can_edit_ui then + -- No need + else -- Adjust frame positions TitanPanel_AdjustFrames(false, "PLAYER_REGEN_ENABLED") - else - -- No need end end @@ -531,7 +531,9 @@ function TitanPanelBarButton:PLAYER_REGEN_DISABLED() TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_DISABLED") end -if TITAN_ID == "TitanClassic" then +if Titan_Global.switch.can_edit_ui then + -- Do not need to adjust frames +else function TitanPanelBarButton:ACTIVE_TALENT_GROUP_CHANGED() -- Is this needed?? -- TitanMovable_AdjustTimer("DualSpec") @@ -552,8 +554,6 @@ if TITAN_ID == "TitanClassic" then --]] -- -else - -- No need end ---Titan Handle the button clicks on any Titan bar. @@ -675,11 +675,11 @@ local function handle_reset_cmds(cmd_list) if not InCombatLockdown() then TitanPanelSetVar("Scale", 1); TitanPanel_InitPanelBarButton("/panelscale reset ") - if TITAN_ID == "TitanClassic" then + if Titan_Global.switch.can_edit_ui then + -- No need + else -- Adjust frame positions TitanPanel_AdjustFrames(true, "/panelscale reset ") - else - -- No need end TitanPrint(L["TITAN_PANEL_SLASH_RESP3"], "info") else @@ -1437,11 +1437,11 @@ function TitanPanelBarButton_DisplayBarsWanted(reason) -- Set anchors for other addons to use. TitanAnchors() - if TITAN_ID == "TitanClassic" then + if Titan_Global.switch.can_edit_ui then + -- Not needed with UI movable widgets + else -- Adjust other frames because the bars shown / hidden may have changed TitanPanel_AdjustFrames(true, "_DisplayBarsWanted") - else - -- Not needed with UI movable widgets end end @@ -1483,16 +1483,12 @@ local function showBar(frame_str) end end - if TITAN_ID == "TitanClassic" then - -- skip, no pet battles yet - else - -- ===== In Pet Battle - if C_PetBattles.IsInBattle() then - if TitanBarData[frame_str].user_move then - -- leave as is - else - flag = false - end + -- ===== In Pet Battle + if C_PetBattles and C_PetBattles.IsInBattle() then + if TitanBarData[frame_str].user_move then + -- leave as is + else + flag = false end end --[[ diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 5459474..5401802 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -121,8 +121,7 @@ end -- helper functions -if TITAN_ID == "Titan" then - --[[ local +--[[ local NAME: TitanAdjustPanelScale DESC: Set the Tian bars and plugins to the selected scale then adjust other frames as needed. VAR: scale - the scale the user has selected for Titan @@ -207,7 +206,7 @@ OUT: None StaticPopup_Show("TITAN_RELOAD"); end end -end + --============= Titan Panel entry -- --[[ local @@ -1112,7 +1111,7 @@ print("Color new:" order = 205, type = "toggle", width = "full", - disabled = (TITAN_ID == "Titan"), + --disabled = (TITAN_ID == "Titan~Classic"), --? Allow in all version ?? get = function() return TitanPanelGetVar("HideBarsInPVP") end, set = function() TitanPanelToggleVar("HideBarsInPVP") @@ -1138,7 +1137,7 @@ print("Color new:" order = 305, type = "toggle", width = "full", - disabled = (TITAN_ID == "Titan"), + disabled = (Titan_Global.switch.can_edit_ui == false), get = function() return TitanPanelGetVar("ScreenAdjust") end, set = function() TitanPanel_ScreenAdjustReload() end, }, @@ -1160,7 +1159,7 @@ print("Color new:" order = 405, type = "toggle", width = "full", - disabled = (TITAN_ID == "Titan"), + disabled = (Titan_Global.switch.can_edit_ui == false), get = function() return TitanPanelGetVar("AuxScreenAdjust") end, set = function() TitanPanel_AuxScreenAdjustReload() end, }, @@ -2885,11 +2884,10 @@ local optionsAdvanced = { } local function BuildAdv() - if TITAN_ID == "Titan" then + if Titan_Global.switch.can_edit_ui then + else optionsAdvanced.args.conftimerdesc = conftimerdesc optionsAdvanced.args.confbuffdesc = confbuffdesc - else - -- Do not need end AceConfigRegistry:NotifyChange("Titan Panel Advanced") diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua index 63de116..d9388bc 100644 --- a/Titan/TitanGlobal.lua +++ b/Titan/TitanGlobal.lua @@ -1,222 +1,250 @@ ---[===[ File -This file contains the global variables and constants used throughout Titan Panel. - -Titan_Global is intended to reduce the global namespace through out Titan over time. -All variables in Global_Titan should be declared here even if set elsewhere. ---]===] - ----@meta -local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) - --- Global variables - -Titan_Global = {} -- begin the slow journey to a smaller _G footprint - -Titan_Global.recent_changes = "" -- Titan_History.lua -Titan_Global.config_notes = "" -- Titan_History.lua - -Titan_Global.AdjList = { -- TODO : localize - ["UIWidgetTopCenterContainerFrame"] = { - frame_name = "UIWidgetTopCenterContainerFrame", - purpose = "Status for BG / Dungeon", - }, -} - -TITAN_PANEL_DEBUG_ARRAY_MAX = 100 -TITAN_PANEL_NONMOVABLE_PLUGINS = {}; -TITAN_PANEL_MENU_FUNC_HIDE = "TitanPanelRightClickMenu_Hide"; -TitanPlugins = {}; -- Used by plugins -TitanPluginsIndex = {}; -TITAN_NOT_REGISTERED = _G["RED_FONT_COLOR_CODE"] .. "Not_Registered_Yet" .. _G["FONT_COLOR_CODE_CLOSE"] -TITAN_REGISTERED = _G["GREEN_FONT_COLOR_CODE"] .. "Registered" .. _G["FONT_COLOR_CODE_CLOSE"] -TITAN_REGISTER_FAILED = _G["RED_FONT_COLOR_CODE"] .. "Failed_to_Register" .. _G["FONT_COLOR_CODE_CLOSE"] - -Titan__InitializedPEW = false -Titan__Initialized_Settings = nil - -TITAN_AT = "@" - -TitanAll = nil; -TitanSettings = nil; -TitanPlayerSettings = nil -TitanPluginSettings = nil; -- Used by plugins -TitanPanelSettings = nil; - -Titan_Global.players = "" - -TITAN_PANEL_UPDATE_BUTTON = 1; -TITAN_PANEL_UPDATE_TOOLTIP = 2; -TITAN_PANEL_UPDATE_ALL = 3; -TitanTooltipOrigScale = 1; -TitanTooltipScaleSet = 0; - --- Set Titan Version var for backwards compatibility, set later -TITAN_VERSION = "" - --- Various constants -TITAN_PANEL_PLACE_TOP = 1; -TITAN_PANEL_PLACE_BOTTOM = 2; -TITAN_PANEL_PLACE_BOTH = 3; -TITAN_PANEL_MOVING = 0; - -TITAN_WOW_SCREEN_TOP = 768 -TITAN_WOW_SCREEN_BOT = 0 - -TITAN_TOP = "Top" -TITAN_BOTTOM = "Bottom" -TITAN_SHORT = "Short" - -TITAN_RIGHT = "Right" -TITAN_LEFT = "Left" -TITAN_PANEL_BUTTONS_ALIGN_LEFT = 1; -TITAN_PANEL_BUTTONS_ALIGN_CENTER = 2; - --- Titan plugins are in the form of TitanPanel<id>Button -Titan_Global.plugin = {} -Titan_Global.plugin.PRE = "TitanPanel" -Titan_Global.plugin.POST = "Button" - - -TITAN_PANEL_CONTROL = "TitanPanelBarButton" --- New bar vars -TITAN_PANEL_BAR_HEIGHT = 24 -TITAN_PANEL_BAR_TEXTURE_HEIGHT = 30 -TITAN_PANEL_AUTOHIDE_PREFIX = "TitanPanelAutoHide_" -TITAN_PANEL_AUTOHIDE_SUFFIX = "Button" -TITAN_PANEL_HIDE_PREFIX = "Titan_Bar__Hider_" -TITAN_PANEL_DISPLAY_PREFIX = "Titan_Bar__Display_" -TITAN_PANEL_DISPLAY_MENU = "Menu_" -TITAN_PANEL_BACKGROUND_PREFIX = "TitanPanelBackground_" -TITAN_PANEL_CLICK_MENU_SUFFIX = "RightClickMenu" -TITAN_PANEL_TEXT = "Text" -TITAN_PANEL_TEXTURE_VAR = "Texture" -TITAN_PANEL_BUTTON_TEXT = "Button" .. TITAN_PANEL_TEXT -TITAN_PANEL_CONSTANTS = { - FONT_SIZE = 10, - FONT_NAME = "Friz Quadrata TT" -} - -TITAN_CUSTOM_PROFILE_POSTFIX = "TitanCustomProfile" -TITAN_PROFILE_NONE = "<>" -TITAN_PROFILE_RESET = "<RESET>" -TITAN_PROFILE_USE = "<USE>" -TITAN_PROFILE_INIT = "<INIT>" - -AUTOHIDE_PREFIX = "TitanPanelAutoHide_" -AUTOHIDE_SUFFIX = "Button" - ---[===[ Var API Adding Categories to Titan Menu -NAME: TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY and TITAN_PANEL_MENU_CATEGORIES -These two tables hold the list of categories for the Titan menu. -Logically they are category - text string pairs. -Where category is the internal label to be used. -Where text is the localized text. -The category should be unique across the table or the menu navigation may be what the user expects. -Some Titan plugins add to this list to make user navigation easier for their Titan plugins. - -Add to these lists by using table insert. Example : -Insert the internal name -table.insert(TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY, "CAT_ZONES") - -Then insert the localized string for the user -local categories = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)["TITAN_PANEL_MENU_CATEGORIES"] -table.insert(categories, "Zones") -Titan uses AceLocale to simplify using localized strings. ---]===] -TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY = -{ "Built-ins", "General", "Combat", "Information", "Interface", "Profession" } ----@diagnostic disable-next-line: assign-type-mismatch -L["TITAN_PANEL_MENU_CATEGORIES"] = { - L["TITAN_PANEL_MENU_CATEGORIES_01"], - L["TITAN_PANEL_MENU_CATEGORIES_02"], - L["TITAN_PANEL_MENU_CATEGORIES_03"], - L["TITAN_PANEL_MENU_CATEGORIES_04"], - L["TITAN_PANEL_MENU_CATEGORIES_05"], - L["TITAN_PANEL_MENU_CATEGORIES_06"], -} - --- Bar background types -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, - high = HIGH, - yes = YES, - no = NO, - help = HELP_LABEL, - mute = MUTE, - muted = MUTED, -} - -Titan_Global.colors = { - alliance = "00adf0", -- PLAYER_FACTION_COLOR_ALLIANCE - blue = "0000ff", -- PURE_BLUE_COLOR - blue_light = "69ccf0", - coin_gold = "ffd100", - coin_silver = "e6e6e6", - coin_copper = "c8602c", - copper = "b87333", - gold = "f2e699", -- GOLD_FONT_COLOR - gray = "808080", -- GRAY_FONT_COLOR - green = "19ff19", -- GREEN_FONT_COLOR - horde = "ff2934", -- PLAYER_FACTION_COLOR_HORDE - orange = "ff8c00", - pink = "f48cb78", - purple = "949cc9", - tan = "c79c6e", - red = "ff2020", -- RED_FONT_COLOR - silver = "cccccc", - white = "ffffff", -- HIGHLIGHT_FONT_COLOR - yellow_gold = "ffd200", -- NORMAL_FONT_COLOR - yellow = "ffff00", -- YELLOW_FONT_COLOR -} - --- type for plugin registry ----@class PluginRegistryType ----@field id string The unique name of the plugin ----@field category? string The Titan menu category where this plugin will be placed ----@field version? string Plugin version ----@field menuText? string Localized string for the menu (right click) ----@field menuTextFunction? string | function Plugin function to call on right click ----@field buttonTextFunction? string | function Function to call when updating button display ----@field tooltipTitle? string Localized string for the menu ----@field tooltipTextFunction? string | function Function to call for a simple tooltip (OnEnter) ----@field tooltipCustomFunction? function Function to call for a complex tooltip (OnEnter) ----@field icon? string Path to the plugin icon ----@field iconWidth? integer Path to the plugin icon ----@field notes? string Brief description shown in Titan > Config > Plugins when this plugin is selected ----@field controlVariables? table Show or not on menu - set to true or false - ShowIcon ShowLabelText ShowColoredText DisplayOnRightSide ----@field savedVariables? table Initial value of any saved variables for this plugin; should include control variables - ----API Return an empty registry - only the id is set. ----@param id string The unique name of the plugin ----@return PluginRegistryType ----This routine was added for use with an IDE with Intellisense that supports Lua. It can be but might not be used. ---- reg = Titan_Global.NewRegistry("MyAddon") -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) +--[===[ File +This file contains the global variables and constants used throughout Titan Panel. + +Titan_Global is intended to reduce the global namespace through out Titan over time. +All variables in Titan_Global should be declared here even if set elsewhere. +--]===] + +---@meta +local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) + +-- Global variables + +Titan_Global = {} -- begin the slow journey to a smaller _G footprint + +Titan_Global.recent_changes = "" -- Titan_History.lua +Titan_Global.config_notes = "" -- Titan_History.lua + +Titan_Global.wowversion = select(4, GetBuildInfo()) + +Titan_Global.switch = {} -- reserved for flags needed because feature / function changed over WoW versions +-- As much as possible, use something in the API to determine feature, not API version. +-- Set defaults to retail feature / function + +Titan_Global.switch.can_edit_ui = true -- if user can modify UI +if C_EditMode then + Titan_Global.switch.can_edit_ui = true -- User changes UI +else + Titan_Global.switch.can_edit_ui = false -- Have Titan adjust UI frame(s) +end + +Titan_Global.switch.game_ammo = false -- if bows and guns use actual ammo +if Titan_Global.wowversion < 40000 then -- before Cata + Titan_Global.switch.game_ammo = true +else + Titan_Global.switch.game_ammo = false +end + +Titan_Global.switch.guild_bank = true -- if guild bank exists +-- as of May 2025 Classic Era does not have guild bank; the routine exists in all versions +if CanGuildBankRepair() then + Titan_Global.switch.guild_bank = true +else + Titan_Global.switch.guild_bank = false +end + +Titan_Global.AdjList = { -- TODO : localize + ["UIWidgetTopCenterContainerFrame"] = { + frame_name = "UIWidgetTopCenterContainerFrame", + purpose = "Status for BG / Dungeon", + }, +} + +TITAN_PANEL_DEBUG_ARRAY_MAX = 100 +TITAN_PANEL_NONMOVABLE_PLUGINS = {}; +TITAN_PANEL_MENU_FUNC_HIDE = "TitanPanelRightClickMenu_Hide"; +TitanPlugins = {}; -- Used by plugins +TitanPluginsIndex = {}; +TITAN_NOT_REGISTERED = _G["RED_FONT_COLOR_CODE"] .. "Not_Registered_Yet" .. _G["FONT_COLOR_CODE_CLOSE"] +TITAN_REGISTERED = _G["GREEN_FONT_COLOR_CODE"] .. "Registered" .. _G["FONT_COLOR_CODE_CLOSE"] +TITAN_REGISTER_FAILED = _G["RED_FONT_COLOR_CODE"] .. "Failed_to_Register" .. _G["FONT_COLOR_CODE_CLOSE"] + +Titan__InitializedPEW = false +Titan__Initialized_Settings = nil + +TITAN_AT = "@" + +TitanAll = nil; +TitanSettings = nil; +TitanPlayerSettings = nil +TitanPluginSettings = nil; -- Used by plugins +TitanPanelSettings = nil; + +Titan_Global.players = "" + +TITAN_PANEL_UPDATE_BUTTON = 1; +TITAN_PANEL_UPDATE_TOOLTIP = 2; +TITAN_PANEL_UPDATE_ALL = 3; +TitanTooltipOrigScale = 1; +TitanTooltipScaleSet = 0; + +-- Set Titan Version var for backwards compatibility, set later +TITAN_VERSION = "" + +-- Various constants +TITAN_PANEL_PLACE_TOP = 1; +TITAN_PANEL_PLACE_BOTTOM = 2; +TITAN_PANEL_PLACE_BOTH = 3; +TITAN_PANEL_MOVING = 0; + +TITAN_WOW_SCREEN_TOP = 768 +TITAN_WOW_SCREEN_BOT = 0 + +TITAN_TOP = "Top" +TITAN_BOTTOM = "Bottom" +TITAN_SHORT = "Short" + +TITAN_RIGHT = "Right" +TITAN_LEFT = "Left" +TITAN_PANEL_BUTTONS_ALIGN_LEFT = 1; +TITAN_PANEL_BUTTONS_ALIGN_CENTER = 2; + +-- Titan plugins are in the form of TitanPanel<id>Button +Titan_Global.plugin = {} +Titan_Global.plugin.PRE = "TitanPanel" +Titan_Global.plugin.POST = "Button" + + +TITAN_PANEL_CONTROL = "TitanPanelBarButton" +-- New bar vars +TITAN_PANEL_BAR_HEIGHT = 24 +TITAN_PANEL_BAR_TEXTURE_HEIGHT = 30 +TITAN_PANEL_AUTOHIDE_PREFIX = "TitanPanelAutoHide_" +TITAN_PANEL_AUTOHIDE_SUFFIX = "Button" +TITAN_PANEL_HIDE_PREFIX = "Titan_Bar__Hider_" +TITAN_PANEL_DISPLAY_PREFIX = "Titan_Bar__Display_" +TITAN_PANEL_DISPLAY_MENU = "Menu_" +TITAN_PANEL_BACKGROUND_PREFIX = "TitanPanelBackground_" +TITAN_PANEL_CLICK_MENU_SUFFIX = "RightClickMenu" +TITAN_PANEL_TEXT = "Text" +TITAN_PANEL_TEXTURE_VAR = "Texture" +TITAN_PANEL_BUTTON_TEXT = "Button" .. TITAN_PANEL_TEXT +TITAN_PANEL_CONSTANTS = { + FONT_SIZE = 10, + FONT_NAME = "Friz Quadrata TT" +} + +TITAN_CUSTOM_PROFILE_POSTFIX = "TitanCustomProfile" +TITAN_PROFILE_NONE = "<>" +TITAN_PROFILE_RESET = "<RESET>" +TITAN_PROFILE_USE = "<USE>" +TITAN_PROFILE_INIT = "<INIT>" + +AUTOHIDE_PREFIX = "TitanPanelAutoHide_" +AUTOHIDE_SUFFIX = "Button" + +--[===[ Var API Adding Categories to Titan Menu +NAME: TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY and TITAN_PANEL_MENU_CATEGORIES +These two tables hold the list of categories for the Titan menu. +Logically they are category - text string pairs. +Where category is the internal label to be used. +Where text is the localized text. +The category should be unique across the table or the menu navigation may be what the user expects. +Some Titan plugins add to this list to make user navigation easier for their Titan plugins. + +Add to these lists by using table insert. Example : +Insert the internal name +table.insert(TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY, "CAT_ZONES") + +Then insert the localized string for the user +local categories = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)["TITAN_PANEL_MENU_CATEGORIES"] +table.insert(categories, "Zones") +Titan uses AceLocale to simplify using localized strings. +--]===] +TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY = +{ "Built-ins", "General", "Combat", "Information", "Interface", "Profession" } +---@diagnostic disable-next-line: assign-type-mismatch +L["TITAN_PANEL_MENU_CATEGORIES"] = { + L["TITAN_PANEL_MENU_CATEGORIES_01"], + L["TITAN_PANEL_MENU_CATEGORIES_02"], + L["TITAN_PANEL_MENU_CATEGORIES_03"], + L["TITAN_PANEL_MENU_CATEGORIES_04"], + L["TITAN_PANEL_MENU_CATEGORIES_05"], + L["TITAN_PANEL_MENU_CATEGORIES_06"], +} + +-- Bar background types +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, + high = HIGH, + yes = YES, + no = NO, + help = HELP_LABEL, + mute = MUTE, + muted = MUTED, +} + +Titan_Global.colors = { + alliance = "00adf0", -- PLAYER_FACTION_COLOR_ALLIANCE + blue = "0000ff", -- PURE_BLUE_COLOR + blue_light = "69ccf0", + coin_gold = "ffd100", + coin_silver = "e6e6e6", + coin_copper = "c8602c", + copper = "b87333", + gold = "f2e699", -- GOLD_FONT_COLOR + gray = "808080", -- GRAY_FONT_COLOR + green = "19ff19", -- GREEN_FONT_COLOR + horde = "ff2934", -- PLAYER_FACTION_COLOR_HORDE + orange = "ff8c00", + pink = "f48cb78", + purple = "949cc9", + tan = "c79c6e", + red = "ff2020", -- RED_FONT_COLOR + silver = "cccccc", + white = "ffffff", -- HIGHLIGHT_FONT_COLOR + yellow_gold = "ffd200", -- NORMAL_FONT_COLOR + yellow = "ffff00", -- YELLOW_FONT_COLOR +} + +-- type for plugin registry +---@class PluginRegistryType +---@field id string The unique name of the plugin +---@field category? string The Titan menu category where this plugin will be placed +---@field version? string Plugin version +---@field menuText? string Localized string for the menu (right click) +---@field menuTextFunction? string | function Plugin function to call on right click +---@field buttonTextFunction? string | function Function to call when updating button display +---@field tooltipTitle? string Localized string for the menu +---@field tooltipTextFunction? string | function Function to call for a simple tooltip (OnEnter) +---@field tooltipCustomFunction? function Function to call for a complex tooltip (OnEnter) +---@field icon? string Path to the plugin icon +---@field iconWidth? integer Path to the plugin icon +---@field notes? string Brief description shown in Titan > Config > Plugins when this plugin is selected +---@field controlVariables? table Show or not on menu - set to true or false - ShowIcon ShowLabelText ShowColoredText DisplayOnRightSide +---@field savedVariables? table Initial value of any saved variables for this plugin; should include control variables + +---API Return an empty registry - only the id is set. +---@param id string The unique name of the plugin +---@return PluginRegistryType +---This routine was added for use with an IDE with Intellisense that supports Lua. It can be but might not be used. +--- reg = Titan_Global.NewRegistry("MyAddon") +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 592fb8e..6106877 100644 --- a/Titan/TitanHistory.lua +++ b/Titan/TitanHistory.lua @@ -1,77 +1,94 @@ ---[===[ File -This file contains Config 'recent changes' and notes. -It should be updated for each Titan release! - -These are in a seperate file to -1) Increase the chance these strings get updated -2) Decrease the chance of breaking the code :). ---]===] - ---[[ Var Release Notes -Detail changes for last 4 - 5 releases. -Format : -Gold - version & date -Green - 'header' - Titan or plugin -Highlight - notes. tips. and details ---]] -Titan_Global.recent_changes = "" -.. TitanUtils_GetGoldText("8.2.5 : 2025/05/22\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- Updates to add timer for drop down menu (was not working in retail and Cata).\n" -.. "- Change drop down menu wrappers (Utils) to use Blizz routines over Ace.\n" -) -.. TitanUtils_GetGoldText("8.2.4 : 2025/02/03\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- TWW version to 11.1.5.\n" -.. TitanUtils_GetGreenText("Repair : \n") -.. "- Updated color code parsing. Thank you to Centias for finding this for us!\n" -) -.. TitanUtils_GetGoldText("8.2.3 : 2025/04/23\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- CE version to 1.15.6.\n" -.. "- Update TOC to use new Addon category tag.\n" -.. "- Update Config to use new AddonCompartment (retail only).\n" -.. TitanUtils_GetGreenText("Location : \n") -.. "- CE only, remove ShowLocOnMinimap.\n" -) -.. TitanUtils_GetGoldText("8.2.2 : 2025/02/05\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- TWW version to 11.1.0.\n" -) -.. TitanUtils_GetGoldText("8.2.1 : 2025/02/03\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- CE version to 1.15.6.\n" -.. "- Gray (disable) Hide if the bar is the only bar.\n" -) -.. TitanUtils_GetGreenText("Gold : \n") -.. TitanUtils_GetHighlightText("" -.. "- Another fix when logging into an 'old' toon.\n" -.. "- Fix error on 'reset database'.\n" -) -.. "\n\n" -.. TitanUtils_GetGoldText("8.2.0 : 2025/01/03\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- Internal fixes to prevent timing issues for built-in plugins on init - any splash screen .\n" -) -.. "\n\n" - ---[[ Var Notes -Use for important notes in the Titan Config About ---]] -Titan_Global.config_notes = "" - .. TitanUtils_GetGoldText("Notes:\n") - .. TitanUtils_GetHighlightText("" - .. - "- Changing Titan Scaling : Short bars will move on screen. They should not go off screen. If Short bars move then drag to desired location. You may have to Reset the Short bar or temporarily disable top or bottom bars to drag the Short bar.\n" - ) - .. "\n" - .. TitanUtils_GetGoldText("Known Issues:\n") - .. TitanUtils_GetHighlightText("" - .. "- Cata : Titan right-click menu may stay visible even if click elsewhere. Hit Esc twice. Investigating...\n" -) +--[===[ File +This file contains Config 'recent changes' and notes. +It should be updated for each Titan release! + +These are in a seperate file to +1) Increase the chance these strings get updated +2) Decrease the chance of breaking the code :). +--]===] + +--[[ Var Release Notes +Detail changes for last 4 - 5 releases. +Format : +Gold - version & date +Green - 'header' - Titan or plugin +Highlight - notes. tips. and details +--]] +Titan_Global.recent_changes = "" +.. TitanUtils_GetGoldText("8.3.0 : 2025/07/15\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- Major change : \n" +.. "- - : Titan users will have their Titan options reset.\n" +.. "- - : Titan plugin options should be the same after update.\n" +.. "- - : Titan 3rd party plugins for Classic must be updated.\n" +.. "- Internally : \n" +.. "- - : TitanClassic is no longer an ID.\n" +.. "- - : Titan Classic 3rd party plugins must use Titan as the dependency in TOC, not TitanClassic.\n" +.. "- - : Saved variables will be in Titan.lua rather than TitanCLassic.lua.\n" +) +.. TitanUtils_GetGoldText("8.2.6 : 2025/06/23\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- TWW version to 11.1.7.\n" +) +.. TitanUtils_GetGoldText("8.2.5 : 2025/05/22\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- Updates to add timer for drop down menu (was not working in retail and Cata).\n" +.. "- Change drop down menu wrappers (Utils) to use Blizz routines over Ace.\n" +) +.. TitanUtils_GetGoldText("8.2.4 : 2025/02/03\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- TWW version to 11.1.5.\n" +.. TitanUtils_GetGreenText("Repair : \n") +.. "- Updated color code parsing. Thank you to Centias for finding this for us!\n" +) +.. TitanUtils_GetGoldText("8.2.3 : 2025/04/23\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- CE version to 1.15.6.\n" +.. "- Update TOC to use new Addon category tag.\n" +.. "- Update Config to use new AddonCompartment (retail only).\n" +.. TitanUtils_GetGreenText("Location : \n") +.. "- CE only, remove ShowLocOnMinimap.\n" +) +.. TitanUtils_GetGoldText("8.2.2 : 2025/02/05\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- TWW version to 11.1.0.\n" +) +.. TitanUtils_GetGoldText("8.2.1 : 2025/02/03\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- CE version to 1.15.6.\n" +.. "- Gray (disable) Hide if the bar is the only bar.\n" +) +.. TitanUtils_GetGreenText("Gold : \n") +.. TitanUtils_GetHighlightText("" +.. "- Another fix when logging into an 'old' toon.\n" +.. "- Fix error on 'reset database'.\n" +) +.. "\n\n" +.. TitanUtils_GetGoldText("8.2.0 : 2025/01/03\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- Internal fixes to prevent timing issues for built-in plugins on init - any splash screen .\n" +) +.. "\n\n" + +--[[ Var Notes +Use for important notes in the Titan Config About +--]] +Titan_Global.config_notes = "" + .. TitanUtils_GetGoldText("Notes:\n") + .. TitanUtils_GetHighlightText("" + .. + "- Changing Titan Scaling : Short bars will move on screen. They should not go off screen. If Short bars move then drag to desired location. You may have to Reset the Short bar or temporarily disable top or bottom bars to drag the Short bar.\n" + ) + .. "\n" + .. TitanUtils_GetGoldText("Known Issues:\n") + .. TitanUtils_GetHighlightText("" + .. "- Cata : Titan right-click menu may stay visible even if click elsewhere. Hit Esc twice. Investigating...\n" +) diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index f6cd249..4a0d71c 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -1,7 +1,7 @@ ---@diagnostic disable: param-type-mismatch --[===[ File Titan adjusts some WoW frames based on the WoW version! -Mainly used for Classic versions where TITAN_ID == "Titan" +Mainly used when user can NOT edit / move most UI frames. DragonFlight introduced an Edit Mode for the user to move various frames where they want them. Titan no longer needs to do this work for most frames. @@ -210,7 +210,9 @@ Messy but declare the lib routines used in the Classic versions Share the calc Y routine --]] -if TITAN_ID == "Titan" then +if Titan_Global.switch.can_edit_ui then + -- User can edit UI frames so Titan will not adjust... +else local hooks_done = false; diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index ec1f91e..1742ed7 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -1063,7 +1063,7 @@ local function Set_bar_vars(to_profile) -- Cannot assume profile is current / cannot use Get Var routines. local panel = TitanSettings.Players[to_profile].Panel - local tex = panel["TexturePath"]:gsub("Titan", "Titan") + local tex = panel["TexturePath"]:gsub("TitanClassic", "Titan") -- hold over, just in case... Titan_Global.dbg:Out("Menu", "tex path '" .. tex .. "'") -- Bring original Titan bar optionss to the current user settings. diff --git a/Titan/_ATitanDoc.lua b/Titan/_ATitanDoc.lua index 5425474..d19e186 100644 --- a/Titan/_ATitanDoc.lua +++ b/Titan/_ATitanDoc.lua @@ -86,22 +86,19 @@ Inside the Titan folder you will notice : === .toc +NOTE: Summer 2025 Titan dropped TitanClassic as a method to make CE and other WoW versions distinct. The folder and the .toc files MUST have the same name! Sort of... the name prior to the underscore(_) must be the same as the folder name. The part after (postfix) has meaning to the WoW addon loader. -WoW has three versions represented by the three postfix values. +This list changes : https://warcraft.wiki.gg/wiki/TOC_format + +Titan uses at least two postfix values. _Mainline : current retail version -_Wrath : Wrath of the Lich King version. _Vanilla : Classic Era version -These values may change as the versions evolve, say Cata is added. -Or they may not :). Years from now we may wonder why Wrath represents Dragonflight! - -Titan uses this TOC method. Notice the Titan folder has no 'wrath' or 'vanilla' .toc. -TitanClassic folder has both 'wrath' and 'vanilla' .toc but no 'mainline' .toc. -This allows Titan to load differently so plugins (built-in or 3rd party) intended for Classic versions can run without change. -Titan has no dependencies but Titan plugins need to list Titan or TitanClassic. +Titan uses this TOC method. Notice a couple built-ins use _Vanilla.toc. +This allows Titan to load plugins (built-in or 3rd party) intended for Classic only without change. === .toc internals NOTE: The ## Interface value should match the current interface value of the corresponding WoW version. diff --git a/Titan/_TitanIDE.lua b/Titan/_TitanIDE.lua index 3d78bc2..d43df56 100644 --- a/Titan/_TitanIDE.lua +++ b/Titan/_TitanIDE.lua @@ -166,7 +166,7 @@ L_UIDROPDOWNMENU_MENU_VALUE = 1 --====== WoW Drop down menu UIDROPDOWNMENU_MENU_VALUE = 1 ----@class LibUIDropDownMenu-4.0 +---@class LibUIDropDownMenu ---@field UIDropDownMenu_InitializeHelper function ---@field Create_UIDropDownMenu function ---@field UIDropDownMenu_Initialize function diff --git a/Titan/_Titan_Lib_Notes.txt b/Titan/_Titan_Lib_Notes.txt index 16125ad..9925a52 100644 --- a/Titan/_Titan_Lib_Notes.txt +++ b/Titan/_Titan_Lib_Notes.txt @@ -1,23 +1,29 @@ -From: -Ace3 - https://www.curseforge.com/wow/addons/ace3 - -AceGUI-3.0-SharedMediaWidgets - https://www.curseforge.com/wow/addons/ace-gui-3-0-shared-media-widgets -LibQTip-1.0 - https://www.curseforge.com/wow/addons/libqtip-1-0 -LibSharedMedia-3.0 - https://www.curseforge.com/wow/addons/libsharedmedia-3-0 -LibUIDropDownMenu - https://www.curseforge.com/wow/addons/libuidropdownmenu - - -*** 2023-Dec *** -- Updated libs to latest -- Added back !LibUIDropDownMenu per combined Titan versions -*** 2023-04-12 *** -- libs created folder for Ace libraries for clarity -- Moved LDB lib to libs -*** 2021-02-10 *** -* Ace3 removed : !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu -*** 2020-12-02 *** -* Ace3 release is used -* Added : -- !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu -- AceGUI-3.0-SharedMediaWidgets : https://www.wowace.com/projects/ace-gui-3-0-shared-media-widgets -- LibSharedMedia-3.0 : https://www.wowace.com/projects/libsharedmedia-3-0 +From: +Ace3 - https://www.curseforge.com/wow/addons/ace3 + +AceGUI-3.0-SharedMediaWidgets - https://www.curseforge.com/wow/addons/ace-gui-3-0-shared-media-widgets +LibQTip-1.0 - https://www.curseforge.com/wow/addons/libqtip-1-0 +LibSharedMedia-3.0 - https://www.curseforge.com/wow/addons/libsharedmedia-3-0 + + +*** 2025-May *** +- Dropped !LibUIDropDownMenu, again; updated wrappers to Blizz version +LibUIDropDownMenu - https://www.curseforge.com/wow/addons/libuidropdownmenu + +*** 2023-Dec *** +- Updated libs to latest +- Added back !LibUIDropDownMenu per combined Titan versions + +*** 2023-04-12 *** +- libs created folder for Ace libraries for clarity +- Moved LDB lib to libs + +*** 2021-02-10 *** +* Ace3 removed : !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu + +*** 2020-12-02 *** +* Ace3 release is used +* Added : +- !LibUIDropDownMenu : https://www.wowace.com/projects/libuidropdownmenu +- AceGUI-3.0-SharedMediaWidgets : https://www.wowace.com/projects/ace-gui-3-0-shared-media-widgets +- LibSharedMedia-3.0 : https://www.wowace.com/projects/libsharedmedia-3-0