diff --git a/Titan/Titan.lua b/Titan/Titan.lua index ca5eeb5..95df6db 100644 --- a/Titan/Titan.lua +++ b/Titan/Titan.lua @@ -1029,13 +1029,13 @@ print("_Tex" ) --]] -- Use the texture / skin per user selectable options - if TitanBarDataVars["Global"].texure == TitanVars.SKIN then + if TitanBarDataVars["Global"].texure == Titan_Panel.SKIN then Set_Skin(frame, titanTexture, TitanBarDataVars["Global"].skin) -- tex_path = TitanPanelGetVar("TexturePath") - elseif TitanBarDataVars["Global"].texure == TitanVars.COLOR then + elseif TitanBarDataVars["Global"].texure == Titan_Panel.COLOR then Set_Color(frame, titanTexture, TitanBarDataVars["Global"].color) - elseif TitanBarDataVars[frame].texure == TitanVars.SKIN then + elseif TitanBarDataVars[frame].texure == Titan_Panel.SKIN then Set_Skin(frame, titanTexture, TitanBarDataVars[frame].skin) - elseif TitanBarDataVars[frame].texure == TitanVars.COLOR then + elseif TitanBarDataVars[frame].texure == Titan_Panel.COLOR then Set_Color(frame, titanTexture, TitanBarDataVars[frame].color) end end @@ -2189,8 +2189,8 @@ local function BuildProfileMenu() -- -- Handle the profiles -- - for idx = 1, #TitanVars.players do - local index = TitanVars.players[idx] + for idx = 1, #Titan_Panel.players do + local index = Titan_Panel.players[idx] local player, server = TitanUtils_ParseName(index) local off = (index == TitanSettings.Player) or ((index == TitanAllGetVar("GlobalProfileUse")) and (TitanAllGetVar("GlobalProfileUse"))) diff --git a/Titan/Titan.toc b/Titan/Titan.toc index 85359f8..6fbec08 100644 --- a/Titan/Titan.toc +++ b/Titan/Titan.toc @@ -1,7 +1,7 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa007.01.00.100100|r ## Author: Titan Panel Development Team -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## SavedVariables: TitanAll, TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat ## Notes: Adds display bars on the top and/or bottom of the screen; also adds user placable bars. Allows users to show and control information/launcher plugins. ## X-Credits: TitanMod, Dark Imakuni, Adsertor, Titan Dev Team diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 0a7d6a4..9a141a2 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -28,32 +28,29 @@ Highlight - notes. tips. and details --]] local notes = "" ..TitanUtils_GetNormalText("" + .."- This is a major update which includes Short Bars; revamped Config screens; and other new features.\n" + .."\n" .."- Titan Bag : Opening bags is still an option until taint issue is resolved.\n" ) local changes = "" do -- recent change history changes = changes - ..TitanUtils_GetGoldText("7.00.03.100007 : 2023/05/07\n") - ..TitanUtils_GetGreenText("Titan : \n") - ..TitanUtils_GetHighlightText("" - .."- Beta Release\n" - .."- Config > Scale and Font : add order of strata to text.\n" - .."- Repair : Add option to show cost in gold only.\n" - .."- Update for API changes in 10.1.\n" - ) - .."\n\n" - ..TitanUtils_GetGoldText("6.00.16.100100 : 2023/05/03\n") + ..TitanUtils_GetGoldText("7.01.00.100007 : 2023/05/28\n") ..TitanUtils_GetGreenText("Titan : \n") ..TitanUtils_GetHighlightText("" .."- Update TOC\n" - .."- Fix for some LDB addons not loading (creation post Player Entering World).\n" + .."- Release Beta as mainline Titan. Includes all 7.x changes,\n" + .."- NEW : Config > Frame Adjust - Adjust one frame that holds widgets such as BG score, Telredor in Outlads, etc.\n" ) .."\n\n" - ..TitanUtils_GetGoldText("6.00.15.100100 : 2023/05/02\n") + ..TitanUtils_GetGoldText("7.00.03.100007 : 2023/05/07\n") ..TitanUtils_GetGreenText("Titan : \n") ..TitanUtils_GetHighlightText("" - .."- Update TOC and WoW version (10.1)\n" - .."- Update for changes Blizzard made API routine which get Addon meta data.\n" + .."- Beta Release\n" + .."- Config > Scale and Font : Add order of strata to options text.\n" + .."- Repair : Add option to display repair in gold only.\n" + .."- Update for API changes in 10.1.\n" + .."- Fix for some LDB addons not loading (creation post Player Entering World).\n" ) .."\n\n" ..TitanUtils_GetGoldText("7.00.02.100007 : 2023/03/31\n") @@ -71,7 +68,7 @@ changes = changes .."- NEW : Can Hide any Titan bar by right click on the Titan bar (not a plugin) then click Hide.\n" .."- NEW : Hide in Combat is now selectable in Config - Global or per bar.\n" .."- NOTE : Solid colors are done via the default color picker. Download an enhanced color picker for more options.\n" - .."- NOTE : Downgrading from Titan 7.xx to 6.xx - Prior to downgrading, move any plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin.\n" + .."- NOTE : Downgrading from Titan 7.xx to 6.xx - Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin.\n" .."--- Titan 6.xx will throw an error IF any plugin is assigned to ANY Short Bar. If Titan throws an error, wipe the Titan saved variables.\n" .."- Configuration > Bars has a new consolidated config for each Titan bar.\n" .."- Configuration > Bars All has a new config for options across all Titan bars.\n" @@ -84,50 +81,6 @@ changes = changes .."- Update TOC\n" ) .."\n\n" - ..TitanUtils_GetGoldText("6.00.14.100007 : 2023/03/29\n") - ..TitanUtils_GetGoldText("6.00.13.100005 : 2023/03/20\n") - ..TitanUtils_GetGreenText("Titan : \n") - ..TitanUtils_GetHighlightText("" - .."- Update TOC only to 10.00.07\n" - ) - .."\n\n" - ..TitanUtils_GetGoldText("6.00.12.100005 : 2023/01/31\n") - ..TitanUtils_GetGreenText("Titan : \n") - ..TitanUtils_GetHighlightText("" - .."- Update TOC\n" - .."- Update Titan settings once on load.\n" - ) - .."\n\n" - ..TitanUtils_GetGoldText("6.00.11.100002 : 2023/01/31\n") - ..TitanUtils_GetGreenText("TitanRepair : \n") - ..TitanUtils_GetHighlightText("" - .."- Can now sell ALL gray items - use with CAUTION!\n" - .."--- Option to to show gray total value on plugin.\n" - .."--- Option to auto sell at vendor.\n" - .."--- Can sell at vendor using Left click on plugin.\n" - ) - ..TitanUtils_GetGreenText("TitanBag : \n") - ..TitanUtils_GetHighlightText("" - .."- Fix so Open Bags option really opens bags if user desires.\n" - ) - ..TitanUtils_GetGreenText("Plugins over another : \n") - ..TitanUtils_GetHighlightText("" - .."- Fix for plugins that could show over another.\n" - ) - ..TitanUtils_GetGreenText("Scaling : \n") - ..TitanUtils_GetHighlightText("" - .."- Fix for error when changing scaling.\n" - ) - ..TitanUtils_GetGreenText("Config : \n") - ..TitanUtils_GetHighlightText("" - .."- About : Add slash command description to About.\n" - .."- Changes : Added to show change history.\n" - ) - ..TitanUtils_GetGreenText("Plugins : \n") - ..TitanUtils_GetHighlightText("" - .."- Labels : Extend custom labels to 2 (second) through 4 (fourth). Plugins should be used / shown at least once, especially if more than one label / value pair is shown by that plugin.\n" - ) - .."\n\n" end TITAN_PANEL_CONFIG = { @@ -149,6 +102,7 @@ TITAN_PANEL_CONFIG = { changes = L["TITAN_PANEL_MENU_CHANGE_HISTORY"], slash = L["TITAN_PANEL_MENU_SLASH_COMMAND"], help = L["TITAN_PANEL_MENU_HELP"], + adjust = "Frame Adjustment", --L["TITAN_PANEL_MENU_HELP"], } } @@ -183,19 +137,19 @@ end -- helper functions -------------- --- about config section +--============= Titan Panel entry +-- --[[ local -NAME: optionsControl +NAME: titan_entry DESC: Local table to hold the 'about' Titan info in the options. --]] -local optionsControl = { +local titan_entry = { name = TITAN_PANEL_CONFIG.topic.About, desc = L["TITAN_PANEL"], type = "group", args = { confgendesc = { - name = "About", + name = "Description", order = 1, type = "group", inline = true, args = { @@ -307,2002 +261,2077 @@ local optionsControl = { } ------------- -------------- +--============= Frame Adjust +-- --[[ local -NAME: optionsSkins -DESC: Local table to hold the Titan skins options. Shows default Titan and any custom skins the user has added. +NAME: optionsAdjust +DESC: Bar control for the main (top) bars: +Each bar: +- Show +- Auto hide +- Center text (plugins) +Main (top) controls: +- Disable screen adjust - allows character frame and minimap to be 'over' the Titan bars +- Disable minimap adjust - allows the minimap to be 'over' the Titan bars +- Ticket frame adjust - adjusts the Blizz open ticket frame to be under the Titan bar(s) +:DESC --]] -local optionsSkins = { - name = TITAN_PANEL_CONFIG.topic.skins, - type = "group", - args = { - } +local optionsAdjust = { + name = TITAN_PANEL_CONFIG.topic.adjust, + type = "group", + args = { + } } --- skins config section +local function ColorAdjShown(frame_str) + local res = "" + if TitanAdjustSettings[frame_str].adjust then + res = frame_str -- leave as is + else + res = "|cff808080"..frame_str.._G["FONT_COLOR_CODE_CLOSE"] + end -local function Show_Skins(t, position) ---[[ - table.sort(TitanSkins, function(a, b) - return string.lower(TitanSkins[a].name) - < string.lower(TitanSkins[b].name) - end) + return res +end + +--[[ local +NAME: TitanUpdateAdj +DESC: Allow the user to control each Titan bar. +:DESC +VAR: None +OUT: None --]] - local skin = "Skin" - for idx, v in pairs (TitanSkins) do - - position = position + 1 -- spacer - t[skin..position] = { - type = "header", - name = "", - order = position, width = "full", - } +local function TitanUpdateAdj(t, pos) + local args = t + local position = pos - position = position + 1 -- Name of skin (col 1) - t[skin..position] = { - type = "description", - name = "|cff19ff19"..v.name.."|r", - order = position, width = "30", - } + -- sort the bar data by their intended order + local bar_list = {} + local i = 0 + for idx, v in pairs (Titan_Panel.AdjList) do + i = i + 1 + bar_list[i] = v + end + table.sort(bar_list, function(a, b) + return a.frame_name < b.frame_name + end) - position = position + 1 -- Top image (col 2) - t[skin..position] = { - type = "description", - name = "", - image = v.path.."TitanPanelBackgroundTop0", - imageWidth = 256, - order = position, width = "50", - } + wipe(args) - position = position + 1 -- spacer - t[skin..position] = { - type = "description", - name = "", imageHeight = 0, - order = position, width = "full", + for idx = 1, #bar_list do + -- ====== + -- Build the frame adjust list in order (left side) + -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1] + local f_name = bar_list[idx].frame_name + local v = TitanAdjustSettings[f_name] -- process this frame + position = position + 1 + args[f_name] = { + type = "group", + name = ColorAdjShown(f_name), + order = position, } - - position = position + 1 -- Bottom (col 1) - t[skin..position] = { - type = "description", - name = "", - order = position, width = "30", + -- ====== + -- adjust options (right side) + args[f_name].args = {} -- .args caused the nesting / right side + position = position + 1 -- Title divider + args[f_name].args.title = { + type = "header", + name = bar_list[idx].purpose, + order = position, width = "full", } - position = position + 1 -- Bottom image (col 2) - t[skin..position] = { - type = "description", - name = "", - image = v.path.."TitanPanelBackgroundBottom0", - imageWidth = 256, - order = position, width = "50", + position = position + 1 -- Show toggle + args[f_name].args.show = { + type = "toggle", width = .75, --"fill", + name = USE or "Use", --L["TITAN_PANEL_MENU_DISPLAY_BAR"], + order = position, + get = function(info) + local frame_str = info[1] + return TitanAdjustSettings[frame_str].adjust + end, + set = function(info, val) + local frame_str = info[1] + TitanAdjustSettings[frame_str].adjust = not TitanAdjustSettings[frame_str].adjust + TitanPanel_AdjustFrame(frame_str, "Adjust show changed : "..tostring(TitanAdjustSettings[frame_str].adjust)) + TitanUpdateAdj(optionsAdjust.args, 1000) + end, } - - position = position + 1 -- final spacer - bottom of config - t[skin..position] = { - type = "description", - name = "", imageHeight = 0, - order = position, width = "full", + -- ====== + position = position + 1 -- offset + args[f_name].args.offset = { + type = "range", width = "full", + name = "Vertical Adjustment", --L["TITAN_TRANS_MENU_TEXT_SHORT"], + order = position, + min = -200, max = 0, step = 1, + get = function(info) + local frame_str = info[1] + return TitanAdjustSettings[frame_str].offset + end, + set = function(info, a) + local frame_str = info[1] + TitanAdjustSettings[frame_str].offset = a +--[[ +print("Cfg Adj" +.." '"..tostring(frame_str).."'" +.." "..tostring(a).."" +) +--]] + TitanPanel_AdjustFrame(frame_str, "Adjust offset changed : "..tostring(a)) + end, } + position = position + 1 -- spacer + args[f_name].args.colorspacer = { + order = position, type = "description", width = "full", + name = " ", + } end - - position = position + 1 -- final spacer - bottom of config - t[skin..position] = { - type = "description", - name = "", - order = position, width = "full", - } + + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Bars") +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", a)).."" +) +--]===] end -local function BuildSkins() - optionsSkins.args = {} - - Show_Skins(optionsSkins.args, 100) -- the current list of skins with images - AceConfigRegistry:NotifyChange("Titan Panel Skin Control") +local function BuildAdj() + TitanUpdateAdj(optionsAdjust.args, 1000) + AceConfigRegistry:NotifyChange("Titan Panel Adjust") end +------------- +--============= Bars +-- --[[ local -NAME: TitanPanel_AddNewSkin -DESC: Add each skin to the options list. If the user had added custom skins these will be shown as well. -VAR: skinname - the file name to use -VAR: skinpath - the file path to use -OUT: None -NOTE: -- Blizz *does not allow* LUA to access the user file system dynamically so the skins have to be input by hand. Titan can not search for available skins in the Artwork folder. -- On the flip side a user can add a custom skin to the Titan saved variables then later delete the skin from the file system. This will not cause an error when the user tries to use (show) that skin but Titan will show a 'blank' skin. -:NOTE +NAME: optionsBars +DESC: Bar control for the main (top) bars: +Each bar: +- Show +- Auto hide +- Center text (plugins) +Main (top) controls: +- Disable screen adjust - allows character frame and minimap to be 'over' the Titan bars +- Disable minimap adjust - allows the minimap to be 'over' the Titan bars +- Ticket frame adjust - adjusts the Blizz open ticket frame to be under the Titan bar(s) +:DESC --]] -local function TitanPanel_AddNewSkin(skinname, skinpath) - -- name and path must be provided - if not skinname or not skinpath then return end - - -- name cannot be empty or "None", path cannot be empty - if skinname == "" or skinname == L["TITAN_NONE"] or skinpath == "" then - return - end - - -- Assume the skin is already in the Titan saved variables list - local found - for _,i in pairs(TitanSkins) do - if i.name == skinname or i.path == skinpath then - found = true - break - end - end +local optionsBars = { + name = TITAN_PANEL_CONFIG.topic.top, + type = "group", + args = { + } +} - -- The skin is new so add it to the Titan saved variables list - if not found then - table.insert(TitanSkins, {name = skinname, path = skinpath }) +local function ColorShown(bar) + local res = bar.locale_name + local frame_str = bar.frame_name + if TitanBarDataVars[frame_str].show then + -- leave as is + else + res = "|cff808080"..res.._G["FONT_COLOR_CODE_CLOSE"] end - - BuildSkins() + return res end --[[ local -NAME: optionsSkinsCustom -DESC: Local table to hold the Titan custom skins options that allow a user to add or delete skins. -- You may not remove the currently used skin -- or the default one -- or a Titan default skin (it would only come back...) +NAME: TitanUpdateConfigBars +DESC: Allow the user to control each Titan bar. :DESC +VAR: None +OUT: None --]] -local optionsSkinsCustom = { - name = TITAN_PANEL_CONFIG.topic.skinscust, --L["TITAN_SKINS_TITLE_CUSTOM"], - type = "group", - args = { - confdesc = { - order = 1, - type = "description", - name = L["TITAN_SKINS_MAIN_DESC"].."\n", - cmdHidden = true - }, - nulloption1 = { - order = 5, - type = "description", - name = " ", - cmdHidden = true - }, - addskinheader = { - order = 10, - type = "header", - name = L["TITAN_SKINS_NEW_HEADER"], - }, - newskinname = { - order = 11, - name = L["TITAN_SKINS_NAME_TITLE"], - desc = L["TITAN_SKINS_NAME_DESC"], - type = "input", width = "full", - get = function() return TitanSkinName end, - set = function(_,v) TitanSkinName = v end, - }, - newskinpath = { - order = 12, - name = L["TITAN_SKINS_PATH_TITLE"], - desc = L["TITAN_SKINS_PATH_DESC"], - type = "input", width = "full", - get = function() return TitanSkinPath end, - set = function(_,v) TitanSkinPath = TitanSkinsCustomPath..v..TitanSkinsPathEnd end, +local function TitanUpdateConfigBars(t, pos) + local args = t + local position = pos - }, - addnewskin = { - order = 13, - name = L["TITAN_SKINS_ADD_HEADER"], type = "execute", - desc = L["TITAN_SKINS_ADD_DESC"], - func = function() - if TitanSkinName ~= "" and TitanSkinPath ~= "" then - TitanPanel_AddNewSkin(TitanSkinName, TitanSkinPath) - TitanSkinName = "" - TitanSkinPath = "" - -- Config Tables changed! - AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") - end - end, - }, - nulloption2 = { - order = 14, - type = "description", - name = " ", - cmdHidden = true - }, - removeskinheader = { - order = 20, + -- sort the bar data by their intended order + local bar_list = {} + for _,v in pairs (TitanBarData) do + bar_list[v.order] = v + end + table.sort(bar_list, function(a, b) + return a.order < b.order + end) + + local label = "Bar" + + wipe(args) + + for idx = 1, #bar_list do + -- ====== + -- Build the bar list in order (left side) + -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1] + local v = bar_list[idx] -- process this bar + position = position + 1 + args[v.name] = { + type = "group", + name = ColorShown(v), + order = position, + } + -- ====== + -- Build bar options (right side) + args[v.name].args = {} -- ,args caused the nesting / right side + position = position + 1 -- Title divider + args[v.name].args.title = { type = "header", - name = L["TITAN_SKINS_REMOVE_HEADER"], - }, - removeskinlist = { - order = 21, type = "select", width = "full", - name = L["TITAN_SKINS_REMOVE_HEADER"], - desc = L["TITAN_SKINS_REMOVE_DESC"], - get = function() return TitanSkinToRemove end, - set = function(_,v) - TitanSkinToRemove = v - end, - values = function() - local Skinlist = {} - local v; - for _,v in pairs (TitanSkins) do - if v.path ~= TitanPanelGetVar("TexturePath") - and v.path ~= "Interface\\AddOns\\Titan\\Artwork\\" - and v.titan ~= true - then - Skinlist[v.path] = "|cff19ff19"..v.name.."|r" - end - if v.path == TitanSkinToRemove then - Skinlist[v.path] = "|cffffff9a"..v.name.."|r" - end - end - if TitanSkinToRemove ~= "None" then - Skinlist["None"] = "|cff19ff19"..L["TITAN_NONE"].."|r" + name = v.locale_name, + order = position, width = "full", + } + position = position + 1 -- Show toggle + args[v.name].args.show = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_DISPLAY_BAR"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].show + end, + set = function(info, val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].show = not TitanBarDataVars[frame_str].show + TitanPanelBarButton_DisplayBarsWanted(info[1].."Show "..tostring(val)) + TitanUpdateConfigBars(optionsBars.args, 1000) + end, + } + position = position + 1 -- Auto hide toggle + args[v.name].args.autohide = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_AUTOHIDE"], + order = position, + disabled = (v.hider == nil), + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].auto_hide + end, + set = function(info, val) + Titan_AutoHide_ToggleAutoHide(info[1]) -- short bar name + end, + } + position = position + 1 -- Center toggle + args[v.name].args.center = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_CENTER_TEXT"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER) + end, + set = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + if (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then + TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_LEFT else - Skinlist["None"] = "|cffffff9a"..L["TITAN_NONE"].."|r" + TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_CENTER end - table.sort(Skinlist, function(a, b) - return string.lower(TitanSkins[a].name) - < string.lower(TitanSkins[b].name) - end) - return Skinlist + + -- Justify button position + TitanPanelButton_Justify(); + end, + } + position = position + 1 -- Combat hide toggle + args[v.name].args.hideincombat = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].hide_in_combat + end, + set = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].hide_in_combat = + not TitanBarDataVars[frame_str].hide_in_combat + end, + } + position = position + 1 -- spacer + args[v.name].args.transpacer1 = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- spacer + args[v.name].args.resetposspacer = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- reset pos + args[v.name].args.resetbar = { + type = "execute", width = "Full", + name = L["TITAN_PANEL_MENU_RESET_POSITION"], + order = position, + disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + func = function(info, arg1) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanVariables_SetBarPos(_G[frame_str], true) + TitanPanelBarButton_DisplayBarsWanted("Bar reset to default position - "..tostring(info[1])) end, - }, - removeskin = { - order = 22, type = "execute", - name = L["TITAN_SKINS_REMOVE_BUTTON"], - desc = L["TITAN_SKINS_REMOVE_BUTTON_DESC"], - func = function() - if TitanSkinToRemove == "None" then return end - local k, v; - for k, v in pairs (TitanSkins) do - if v.path == TitanSkinToRemove then - table.remove(TitanSkins, k) + } + -- ====== + -- Background group + position = position + 1 -- background + args[v.name].args.back = { + type = "header", + name = "=== "..BACKGROUND.." ===", + order = position, + } + position = position + 1 -- select background + args[v.name].args.settextousebar = { + name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], + desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], + order = position, type = "select", width = "full", + style = "radio", + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].texure end, + set = function(info, val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].texure = val + TitanPanel_SetBarTexture(frame_str) + end, + values = { + [Titan_Panel.SKIN] = L["TITAN_SKINS_TITLE"], + [Titan_Panel.COLOR] = COLOR, + }, + } + position = position + 1 -- Title divider + args[v.name].args.skintitle = { + type = "header", + name = L["TITAN_SKINS_TITLE"], + order = position, width = "full", + } + position = position + 1 -- Skin select + args[v.name].args.skinselect = { + type = "select", width = "normal", + name = "", --v.locale_name, + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].skin.path + end, + set = function(info,val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].skin.path = val + TitanPanel_SetBarTexture(frame_str) + if TitanSkinToRemove == TitanPanelGetVar("Texture"..info[1]) then TitanSkinToRemove = "None" - -- Config Tables changed! - AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") - break end - end - end, - }, - nulloption4 = { - order = 24, - type = "description", - name = " ", - cmdHidden = true - }, - resetskinhdear = { - order = 200, - type = "header", - name = L["TITAN_SKINS_RESET_HEADER"], - }, - defaultskins = { - order = 201, - name = L["TITAN_SKINS_RESET_DEFAULTS_TITLE"], type = "execute", - desc = L["TITAN_SKINS_RESET_DEFAULTS_DESC"], - func = function() - TitanSkins = TitanSkinsDefault; - BuildSkins() end, - }, - notes_delete = { - order = 999, - type = "description", - name = "\n\n"..L["TITAN_SKINS_REMOVE_NOTES"].."\n", - cmdHidden = true - }, - } -} -------------- + values = function(info) + local Skinlist = {} + local frame_str = TitanVariables_GetFrameName(info[1]) + for _, val in pairs (TitanSkins) do + if val.path ~= TitanBarDataVars[frame_str].skin.path then + -- if val.path ~= TitanPanelGetVar("Texture"..v.name) then + Skinlist[val.path] = "|cff19ff19"..val.name.."|r" + else + Skinlist[val.path] = "|cffffff9a"..val.name.."|r" + end + end + table.sort(Skinlist, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) + return Skinlist + end, + } + position = position + 1 -- spacer + args[v.name].args.skinspacer = { + order = position, type = "description", width = "5", + name = " ", + } + position = position + 1 -- selected skin + args[v.name].args.skinselected = { + name = "", + image = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + local vert = TitanBarData[frame_str].vert + if vert == TITAN_SHORT then + vert = TITAN_TOP + else + -- Use it as is + end + return TitanBarDataVars[frame_str].skin.path.."TitanPanelBackground"..vert.."0" + end, + imageWidth = 256, + order = position, type = "description", width = .5, --"60", + } + position = position + 1 -- transparency + args[v.name].args.trans = { + type = "range", width = "full", + name = L["TITAN_TRANS_MENU_TEXT_SHORT"], + order = position, + min = 0, max = 1, step = 0.01, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].skin.alpha + end, + set = function(info, a) + local frame_str = TitanVariables_GetFrameName(info[1]) + _G[frame_str]:SetAlpha(a) + TitanBarDataVars[frame_str].skin.alpha = a + end, + } + position = position + 1 -- Title divider + args[v.name].args.colortitle = { + type = "header", + name = COLOR, + order = position, width = "full", + } + position = position + 1 -- spacer + args[v.name].args.colorspacer = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- reset pos + args[v.name].args.colorselect = { + type = "color", width = "Full", + name = "Select Bar Color", -- L["TITAN_PANEL_MENU_RESET_POSITION"], + order = position, + -- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + hasAlpha = true, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + local color = TitanBarDataVars[frame_str].color + return color.r, + color.g, + color.b, + color.alpha + end, + set = function(info, r, g, b, a) + local frame_str = TitanVariables_GetFrameName(info[1]) + + TitanBarDataVars[frame_str].color.r = r + TitanBarDataVars[frame_str].color.g = g + TitanBarDataVars[frame_str].color.b = b + TitanBarDataVars[frame_str].color.alpha = a + TitanPanel_SetBarTexture(frame_str) + end, + } + end + + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Bars") +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", a)).."" +) +--]===] +end +local function BuildBars() + TitanUpdateConfigBars(optionsBars.args, 1000) + AceConfigRegistry:NotifyChange("Titan Panel Bars") +end ------------- --- UI scale config section ---[[ local -NAME: optionsUIScale -DESC: Local table to hold the Titan options that allow a user to adjust: -- UI scale -- Titan scale for bars -- Spacing between Titan plugins (right side) -- Spacing between Titan icons (left side) -- Titan tooltip font scale (bar and plugins) -- Toggle the tooltip font scale (allow Titan or Blizz to control) -- Set Titan font (bar and plugins) -- Set Titan font size -- Set Titan bar strata (tells Blizz which frames could go over Titan bar (and plugins) -:DESC ---]] -local optionsUIScale = { - name = TITAN_PANEL_CONFIG.topic.scale, --L["TITAN_UISCALE_MENU_TEXT"], + +--============= Bars - All + +local optionsGlobals = { + name = TITAN_PANEL_CONFIG.topic.globals, type = "group", args = { confdesc = { - order = 1, - type = "description", - name = L["TITAN_UISCALE_MENU_DESC"].."\n", - cmdHidden = true + order = 10, width = "full", + type = "header", + name = L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], }, - uiscale = { - name = L["TITAN_UISCALE_CONTROL_TITLE_UI"], - desc = L["TITAN_UISCALE_SLIDER_DESC"], - order = 2, type = "range", width = "full", - min = 0.64, max = 1, step = 0.01, - get = function() return UIParent:GetScale() end, - set = function(_, a) - SetCVar("useUiScale", 1); - SetCVar("uiScale", a, "uiScale"); + setskinuseglobal = { + name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], + desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], + order = 15, type = "select", width = "full", + style = "radio", + get = function() return TitanBarDataVars["Global"].texure end, + set = function(_, v) + TitanBarDataVars["Global"].texure = v + for idx, val in pairs (TitanBarData) do + TitanPanel_SetBarTexture(idx) + end end, + values = { + [Titan_Panel.SKIN] = L["TITAN_SKINS_TITLE"], + [Titan_Panel.COLOR] = COLOR, + [Titan_Panel.NONE] = NONE, + }, }, - panelscale = { - name = L["TITAN_UISCALE_CONTROL_TITLE_PANEL"], - desc = L["TITAN_UISCALE_PANEL_SLIDER_DESC"], - order = 3, type = "range", width = "full", - min = 0.75, max = 1.25, step = 0.01, - get = function() return TitanPanelGetVar("Scale") end, - set = function(_, a) - TitanPanelSetVar("Scale", a) --- TitanPanel_SetScale() - TitanPanel_InitPanelBarButton("Config scale change "..a) + confskindesc = { + order = 20, width = "full", + type = "description", + name = L["TITAN_SKINS_TITLE"], + }, + setskinglobal = { + order = 21, type = "select", width = "30", + name = " ", --L["TITAN_SKINS_LIST_TITLE"], + desc = L["TITAN_SKINS_SET_DESC"], + get = function() return TitanBarDataVars["Global"].skin.path end, + set = function(_,v) + TitanBarDataVars["Global"].skin.path = v --TitanPanelSetVar("TexturePath", v); + if TitanBarDataVars["Global"].texure == Titan_Panel.SKIN then + for idx, val in pairs (TitanBarData) do + TitanPanel_SetBarTexture(idx) + end + end end, - disabled = function() - if InCombatLockdown() then - return true - else - return false + 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] = "|cff19ff19"..v.name.."|r" + else + Skinlist[v.path] = "|cffffff9a"..v.name.."|r" + end end + table.sort(Skinlist, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) + return Skinlist end, }, - buttonspacing = { - name = L["TITAN_UISCALE_CONTROL_TITLE_BUTTON"], - desc = L["TITAN_UISCALE_BUTTON_SLIDER_DESC"], - order = 4, type = "range", width = "full", - min = 5, max = 80, step = 1, - get = function() return TitanPanelGetVar("ButtonSpacing") end, - set = function(_, a) - TitanPanelSetVar("ButtonSpacing", a); - TitanPanel_InitPanelButtons(); - end, + show_skin_top_desc = { + type = "description", + name = "", + order = 30, width = "10", }, - iconspacing = { -- right side plugins - name = L["TITAN_UISCALE_CONTROL_TITLE_ICON"], - desc = L["TITAN_UISCALE_ICON_SLIDER_DESC"], - order = 5, type = "range", width = "full", - min = 0, max = 20, step = 1, - get = function() return TitanPanelGetVar("IconSpacing") end, - set = function(_, a) - TitanPanelSetVar("IconSpacing", a); - TitanPanel_InitPanelButtons(); - end, - }, - spacer01 = { + show_skin_global_top = { type = "description", - name = "\n\n", imageHeight = 0, - order = 10, width = "full", + name = "", + image = function() + return TitanBarDataVars["Global"].skin.path.."TitanPanelBackgroundTop0" +-- return TitanPanelGetVar("TexturePath").."TitanPanelBackgroundTop0" + end, + imageWidth = 256, + order = 31, width = "60", }, - tooltipdesc = { - order = 20, width = "full", - type = "header", - name = "Tooltip", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + confcolorspacer = { -- spacer + order = 50, type = "description", width = "full", + name = " ", + }, + confcolordesc = { + order = 51, width = "full", + type = "description", + name = COLOR, }, - tooltipfont = { - name = L["TITAN_UISCALE_CONTROL_TOOLTIP_TOOLTIPFONT"], - desc = L["TITAN_UISCALE_TOOLTIP_SLIDER_DESC"], - order = 21, type = "range", width = "full", - min = 0.5, max = 1.3, step = 0.01, - get = function() return TitanPanelGetVar("TooltipFont") end, - set = function(_, a) - TitanPanelSetVar("TooltipFont", a); + show_skin_color_picker = { + type = "color", width = "Full", + name = "Select Bar Color", -- L["TITAN_PANEL_MENU_RESET_POSITION"], + order = 55, +-- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + hasAlpha = true, + get = function() + local color = TitanBarDataVars["Global"].color + return color.r, + color.g, + color.b, + color.alpha end, - }, - tooltipfontdisable = { - name = L["TITAN_UISCALE_TOOLTIP_DISABLE_TEXT"], - desc = L["TITAN_UISCALE_DISABLE_TOOLTIP_DESC"], - order = 22, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("DisableTooltipFont") end, - set = function() - TitanPanelToggleVar("DisableTooltipFont"); + set = function(info, r, g, b, a) +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", 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_Panel.COLOR then + for idx, val in pairs (TitanBarData) do + TitanPanel_SetBarTexture(idx) + end + end end, }, - fontdesc = { - order = 30, width = "full", + hidecombatspacer = { -- spacer + order = 100, type = "description", width = "full", + name = " ", + }, + confcombatdesc = { + order = 101, width = "full", type = "header", - name = "Font", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + name = L["TITAN_PANEL_MENU_COMMAND"], }, - fontselection = { - name = L["TITAN_PANEL_MENU_LSM_FONTS"], - desc = L["TITAN_PANEL_MENU_LSM_FONTS_DESC"], - order = 31, type = "select", width = "40", - dialogControl = "LSM30_Font", - get = function() - return TitanPanelGetVar("FontName") - end, - set = function(_, v) - TitanPanelSetVar("FontName", v) - TitanSetPanelFont(v, TitanPanelGetVar("FontSize")) - end, - values = AceGUIWidgetLSMlists.font, + setcombatuseglobal = { + name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], + desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], + order = 105, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideBarsInCombat") end, + set = function() TitanPanelToggleVar("HideBarsInCombat"); end, }, - fontspacer = { - order = 32, type = "description", width = "20", + arenaspacer = { -- spacer + order = 200, type = "description", width = "full", name = " ", }, - fontsize = { - name = L["TITAN_PANEL_MENU_FONT_SIZE"], - desc = L["TITAN_PANEL_MENU_FONT_SIZE_DESC"], - order = 33, type = "range", width = "40", - min = 7, max = 15, step = 1, - get = function() return TitanPanelGetVar("FontSize") end, - set = function(_, v) - TitanPanelSetVar("FontSize", v); - TitanSetPanelFont(TitanPanelGetVar("FontName"), v) - end, - }, - paneldesc = { - order = 40, width = "full", + confarenadesc = { + order = 201, width = "full", type = "header", - name = "Strata", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + name = BATTLEGROUND.." / "..ARENA, }, - panelstrata = { - name = L["TITAN_PANEL_MENU_FRAME_STRATA"], - desc = L["TITAN_PANEL_MENU_FRAME_STRATA_DESC"], - order = 41, type = "select", - get = function() - return TitanPanelGetVar("FrameStrata") - end, - set = function(_, v) - TitanPanelSetVar("FrameStrata", v) - TitanVariables_SetPanelStrata(v) - end, - values = { - ["BACKGROUND"] = "BACKGROUND", - ["LOW"] = "LOW", - ["MEDIUM"] = "MEDIUM", - ["HIGH"] = "HIGH", - ["DIALOG"] = "DIALOG", - ["FULLSCREEN"] = "FULLSCREEN", - }, + 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 = 205, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideBarsInPVP") end, + set = function() + TitanPanelToggleVar("HideBarsInPVP") + TitanPanelBarButton_DisplayBarsWanted("HideBarsInPVP" + .." "..tostring(TitanPanelGetVar("HideBarsInPVP"))) + end, }, } } ------------- -------------- --- Bar control config section +--============= Plugins + --[[ local -NAME: optionsBars -DESC: Bar control for the main (top) bars: -Each bar: -- Show -- Auto hide -- Center text (plugins) -Main (top) controls: -- Disable screen adjust - allows character frame and minimap to be 'over' the Titan bars -- Disable minimap adjust - allows the minimap to be 'over' the Titan bars -- Ticket frame adjust - adjusts the Blizz open ticket frame to be under the Titan bar(s) -:DESC +NAME: optionsAddons +DESC: This is the table shell. The plugin controls will be added by another routine. --]] -local optionsBars = { - name = TITAN_PANEL_CONFIG.topic.top, +local optionsAddons = { + name = TITAN_PANEL_CONFIG.topic.plugins, --"Titan "..L["TITAN_PANEL_MENU_PLUGINS"], type = "group", - args = { - } + args = {} } -local function ColorShown(bar) - local res = bar.locale_name - local frame_str = bar.frame_name - if TitanBarDataVars[frame_str].show then - -- leave as is +local function ColorVisible(id, name) + local res = "?" + if TitanPanel_IsPluginShown(id) then + res = (name or "") else - res = "|cff808080"..res.._G["FONT_COLOR_CODE_CLOSE"] + res = "|cff808080"..name.._G["FONT_COLOR_CODE_CLOSE"] end - + return res end --[[ local -NAME: TitanUpdateConfigBars -DESC: Allow the user to control each Titan bar. +NAME: TitanUpdateConfigAddons +DESC: Allow the user to control each plugin registered to Titan. +Controls honored from the plugin .registry: +- Show +- Show label text +- Right side +- Show icon +- Show text +Position: +- Shift left one plugin position on the bar +- Shift right one plugin position on the bar +- The shift is on the same bar +- The shift will not move a plugin from one side to the other +Bar: +- Drop down so the user can pick the bar the plugin is to be shown on. +- The list contains only the bars the user has selected to be shown. +- The user can not move a plugin to a hidden bar to 'hide' it. The user should ensure "Show Plugin" is unchecked. :DESC VAR: None OUT: None --]] -local function TitanUpdateConfigBars(t, pos) - local args = t - local position = pos - - -- sort the bar data by their intended order - local bar_list = {} - for _,v in pairs (TitanBarData) do - bar_list[v.order] = v - end - table.sort(bar_list, function(a, b) - return a.order < b.order - end) - - local label = "Bar" +local function TitanUpdateConfigAddons() + local args = optionsAddons.args + local plug_in = nil + local plug_version = "" wipe(args) - for idx = 1, #bar_list do - -- ====== - -- Build the bar list in order (left side) - -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1] - local v = bar_list[idx] -- process this bar - position = position + 1 - args[v.name] = { - type = "group", - name = ColorShown(v), - order = position, - } - -- ====== - -- Build bar options (right side) - args[v.name].args = {} -- ,args caused the nesting / right side - position = position + 1 -- Title divider - args[v.name].args.title = { - type = "header", - name = v.locale_name, - order = position, width = "full", - } - position = position + 1 -- Show toggle - args[v.name].args.show = { - type = "toggle", width = .75, --"fill", - name = L["TITAN_PANEL_MENU_DISPLAY_BAR"], - order = position, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].show - end, - set = function(info, val) - local frame_str = TitanVariables_GetFrameName(info[1]) - TitanBarDataVars[frame_str].show = not TitanBarDataVars[frame_str].show - TitanPanelBarButton_DisplayBarsWanted(info[1].."Show "..tostring(val)) - TitanUpdateConfigBars(optionsBars.args, 1000) - end, - } - position = position + 1 -- Auto hide toggle - args[v.name].args.autohide = { - type = "toggle", width = .75, --"fill", - name = L["TITAN_PANEL_MENU_AUTOHIDE"], - order = position, - disabled = (v.hider == nil), - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].auto_hide - end, - set = function(info, val) - Titan_AutoHide_ToggleAutoHide(info[1]) -- short bar name - end, + for idx, value in pairs(TitanPluginsIndex) do + plug_in = TitanUtils_GetPlugin(TitanPluginsIndex[idx]) + if plug_in then + if plug_in.version then + plug_version = TitanUtils_GetGreenText(" ("..plug_in.version..")") + else + plug_version = "" + end + args[plug_in.id] = { + type = "group", + name = ColorVisible(plug_in.id, plug_in.menuText or ""), + order = idx, + args = { + name = { + type = "header", + name = ((plug_in.menuText or "")..plug_version), + order = 1, + }, + show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW"], + order = 3, + get = function(info) return (TitanPanel_IsPluginShown(info[1])) end, + set = function(info, v) + local name = info[1] + if v then -- Show / add + local bar = (TitanGetVar(name, "ForceBar") or TitanUtils_PickBar()) + TitanUtils_AddButtonOnBar(bar, name) + else -- Hide / remove + TitanPanel_RemoveButton(name) + end + TitanUpdateConfigAddons() + end, + }, + } } - position = position + 1 -- Center toggle - args[v.name].args.center = { - type = "toggle", width = .75, --"fill", - name = L["TITAN_PANEL_MENU_CENTER_TEXT"], - order = position, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER) - end, - set = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - if (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then - TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_LEFT - else - TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_CENTER - end + + --ShowIcon + if plug_in.controlVariables and plug_in.controlVariables.ShowIcon then + args[plug_in.id].args.icon = + { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_ICON"], + order = 4, + get = function(info) return (TitanGetVar(info[1], "ShowIcon")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowIcon"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end - -- Justify button position - TitanPanelButton_Justify(); - end, + --ShowLabel + if plug_in.controlVariables and plug_in.controlVariables.ShowLabelText then + args[plug_in.id].args.label = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"], + order = 5, + get = function(info) return (TitanGetVar(info[1], "ShowLabelText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowLabelText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + --ShowRegularText (LDB data sources only atm) + if plug_in.controlVariables and plug_in.controlVariables.ShowRegularText then + args[plug_in.id].args.regular_text = + { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_PLUGIN_TEXT"], + order = 6, + get = function(info) return (TitanGetVar(info[1], "ShowRegularText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowRegularText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + --ShowColoredText + if plug_in.controlVariables and plug_in.controlVariables.ShowColoredText then + args[plug_in.id].args.color_text = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"], + order = 7, + get = function(info) return (TitanGetVar(info[1], "ShowColoredText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowColoredText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + -- Right-side plugin + if plug_in.controlVariables and plug_in.controlVariables.DisplayOnRightSide then + args[plug_in.id].args.right_side = { + type = "toggle", + name = L["TITAN_PANEL_MENU_LDB_SIDE"], + order = 8, + get = function(info) return (TitanGetVar(info[1], "DisplayOnRightSide")) end, + set = function(info, v) + local bar = TitanUtils_GetWhichBar(info[1]) + TitanToggleVar(info[1], "DisplayOnRightSide"); + TitanPanel_RemoveButton(info[1]); + TitanUtils_AddButtonOnBar(bar, info[1]); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + -- Shift R / L + args[plug_in.id].args.plugin_position = { + order = 50, + type = "header", + name = L["TITAN_PANEL_MENU_POSITION"], } - position = position + 1 -- Combat hide toggle - args[v.name].args.hideincombat = { - type = "toggle", width = .75, --"fill", - name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], - order = position, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].hide_in_combat - end, - set = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - TitanBarDataVars[frame_str].hide_in_combat = - not TitanBarDataVars[frame_str].hide_in_combat + args[plug_in.id].args.shift_left = { + type = "execute", + name = "< "..L["TITAN_PANEL_SHIFT_LEFT"].." ", + order = 51, + func = function(info, arg1) + local name = info[1] + if TitanPanel_IsPluginShown(name) then + TitanUtils_ShiftButtonOnBarLeft(name) + end end, } - position = position + 1 -- spacer - args[v.name].args.transpacer1 = { - order = position, type = "description", width = "full", - name = " ", - } - position = position + 1 -- spacer - args[v.name].args.resetposspacer = { - order = position, type = "description", width = "full", - name = " ", - } - position = position + 1 -- reset pos - args[v.name].args.resetbar = { - type = "execute", width = "Full", - name = L["TITAN_PANEL_MENU_RESET_POSITION"], - order = position, - disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), - func = function(info, arg1) - local frame_str = TitanVariables_GetFrameName(info[1]) - TitanVariables_SetBarPos(_G[frame_str], true) - TitanPanelBarButton_DisplayBarsWanted("Bar reset to default position - "..tostring(info[1])) - end, - } - -- ====== - -- Background group - position = position + 1 -- background - args[v.name].args.back = { - type = "header", - name = "=== "..BACKGROUND.." ===", - order = position, - } - position = position + 1 -- select background - args[v.name].args.settextousebar = { - name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], - desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], - order = position, type = "select", width = "full", - style = "radio", - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].texure end, - set = function(info, val) - local frame_str = TitanVariables_GetFrameName(info[1]) - TitanBarDataVars[frame_str].texure = val - TitanPanel_SetBarTexture(frame_str) + args[plug_in.id].args.shift_right = { + type = "execute", + name = "> "..L["TITAN_PANEL_SHIFT_RIGHT"], + order = 52, + func = function(info, arg1) + local name = info[1] + if TitanPanel_IsPluginShown(info[1]) then + TitanUtils_ShiftButtonOnBarRight(name) + end end, - values = { - [TitanVars.SKIN] = L["TITAN_SKINS_TITLE"], - [TitanVars.COLOR] = COLOR, - }, } - position = position + 1 -- Title divider - args[v.name].args.skintitle = { + args[plug_in.id].args.space_50_1 = { + order = 53, type = "header", - name = L["TITAN_SKINS_TITLE"], - order = position, width = "full", + name = L["TITAN_PANEL_MENU_BAR"], } - position = position + 1 -- Skin select - args[v.name].args.skinselect = { - type = "select", width = "normal", - name = "", --v.locale_name, - order = position, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].skin.path - end, - set = function(info,val) - local frame_str = TitanVariables_GetFrameName(info[1]) - TitanBarDataVars[frame_str].skin.path = val - TitanPanel_SetBarTexture(frame_str) - if TitanSkinToRemove == TitanPanelGetVar("Texture"..info[1]) then - TitanSkinToRemove = "None" - end - end, - values = function(info) - local Skinlist = {} - local frame_str = TitanVariables_GetFrameName(info[1]) - for _, val in pairs (TitanSkins) do - if val.path ~= TitanBarDataVars[frame_str].skin.path then - -- if val.path ~= TitanPanelGetVar("Texture"..v.name) then - Skinlist[val.path] = "|cff19ff19"..val.name.."|r" - else - Skinlist[val.path] = "|cffffff9a"..val.name.."|r" + if not TitanVarExists(plug_in.id, "ForceBar") then + args[plug_in.id].args.top_bottom = { + order = 54, type = "select", + name = L["TITAN_PANEL_MENU_BAR"], + desc = L["TITAN_PANEL_MENU_DISPLAY_ON_BAR"], + get = function(info) + return TitanUtils_GetWhichBar(info[1]) end, + set = function(info,v) + local name = info[1] + if TitanPanel_IsPluginShown(name) then + TitanUtils_AddButtonOnBar(v, name) end - end - table.sort(Skinlist, function(a, b) - return string.lower(TitanSkins[a].name) - < string.lower(TitanSkins[b].name) - end) - return Skinlist end, - } - position = position + 1 -- spacer - args[v.name].args.skinspacer = { - order = position, type = "description", width = "5", - name = " ", - } - position = position + 1 -- selected skin - args[v.name].args.skinselected = { - name = "", - image = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - local vert = TitanBarData[frame_str].vert - if vert == TITAN_SHORT then - vert = TITAN_TOP - else - -- Use it as is - end - return TitanBarDataVars[frame_str].skin.path.."TitanPanelBackground"..vert.."0" + values = function() + local Locationlist = {} + local v + for idx,v in pairs (TitanBarData) do + if TitanBarDataVars[idx].show then +-- if TitanPanelGetVar(TitanBarData[idx].name.."_Show") then + Locationlist[TitanBarData[idx].name] = TitanBarData[idx].locale_name + end + end + return Locationlist end, - imageWidth = 256, - order = position, type = "description", width = .5, --"60", } - position = position + 1 -- transparency - args[v.name].args.trans = { - type = "range", width = "full", - name = L["TITAN_TRANS_MENU_TEXT_SHORT"], - order = position, - min = 0, max = 1, step = 0.01, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - return TitanBarDataVars[frame_str].skin.alpha - end, - set = function(info, a) - local frame_str = TitanVariables_GetFrameName(info[1]) - _G[frame_str]:SetAlpha(a) - TitanBarDataVars[frame_str].skin.alpha = a - end, + else + args[plug_in.id].args.top_bottom = { + order = 54, + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_MENU_BAR_ALWAYS"].." "..TitanGetVar(plug_in.id, "ForceBar")), + cmdHidden = true, + } + end + args[plug_in.id].args.space_50_2 = { + order = 59, + type = "description", + name = " ", + cmdHidden = true, } - position = position + 1 -- Title divider - args[v.name].args.colortitle = { + -- Notes, if available + args[plug_in.id].args.custom_notes = { + order = 60, type = "header", - name = COLOR, - order = position, width = "full", + name = L["TITAN_PANEL_MENU_ADV_NOTES_PLUGIN"], } - position = position + 1 -- spacer - args[v.name].args.colorspacer = { - order = position, type = "description", width = "full", - name = " ", + if plug_in.notes then + args[plug_in.id].args.notes = { + type = "description", + name = L["TITAN_PANEL_MENU_ADV_NOTES"], + order = 61, + name = "" + .._G["GREEN_FONT_COLOR_CODE"]..plug_in.notes.."|r", + cmdHidden = true, } - position = position + 1 -- reset pos - args[v.name].args.colorselect = { - type = "color", width = "Full", - name = "Select Bar Color", -- L["TITAN_PANEL_MENU_RESET_POSITION"], - order = position, - -- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), - hasAlpha = true, - get = function(info) - local frame_str = TitanVariables_GetFrameName(info[1]) - local color = TitanBarDataVars[frame_str].color - return color.r, - color.g, - color.b, - color.alpha - end, - set = function(info, r, g, b, a) - local frame_str = TitanVariables_GetFrameName(info[1]) + else + args[plug_in.id].args.notes = { + type = "description", + name = L["TITAN_PANEL_MENU_ADV_NOTES"], + order = 61, + name = _G["GREEN_FONT_COLOR_CODE"]..L["TITAN_NONE"].."|r", + cmdHidden = true, + } + end + -- + -- Custom Labels 1 - 4 + local num_labels = tonumber(TitanGetVar(plug_in.id, "NumLabelsSeen") or 1) - TitanBarDataVars[frame_str].color.r = r - TitanBarDataVars[frame_str].color.g = g - TitanBarDataVars[frame_str].color.b = b - TitanBarDataVars[frame_str].color.alpha = a - TitanPanel_SetBarTexture(frame_str) - end, - } + if num_labels >= 1 then + args[plug_in.id].args.custom_labels = { + order = 70, + type = "header", + name = L["TITAN_PANEL_MENU_ADV_LABEL"], + } + args[plug_in.id].args.custom_label_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 1", + order = 71, + get = function(info) return (TitanGetVar(info[1], "CustomLabelTextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabelTextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label_text = { + order = 72, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabelText") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabelText", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 2 then + args[plug_in.id].args.custom_label2_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 2", + order = 73, + get = function(info) return (TitanGetVar(info[1], "CustomLabel2TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel2TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label2_text = { + order = 74, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel2Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel2Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 3 then + args[plug_in.id].args.custom_label3_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 3", + order = 75, + get = function(info) return (TitanGetVar(info[1], "CustomLabel3TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel3TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label3_text = { + order = 76, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel3Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel3Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 4 then + args[plug_in.id].args.custom_label4_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 4", + order = 77, + get = function(info) return (TitanGetVar(info[1], "CustomLabel4TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel4TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label4_text = { + order = 78, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel4Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel4Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + end end -- Config Tables changed! - AceConfigRegistry:NotifyChange("Titan Panel Bars") ---[===[ -print("Color new:" -.." "..tostring(format("%0.1f", r)).."" -.." "..tostring(format("%0.1f", g)).."" -.." "..tostring(format("%0.1f", b)).."" -.." "..tostring(format("%0.1f", a)).."" -) ---]===] -end - -local function BuildBars() - TitanUpdateConfigBars(optionsBars.args, 1000) - AceConfigRegistry:NotifyChange("Titan Panel Bars") + AceConfigRegistry:NotifyChange("Titan Panel Addon Control") end - ------------- --- Help config section -local help_text = "" -do -- set help_text -help_text = "" - ..TitanUtils_GetGreenText("Short Bars: \n") - ..TitanUtils_GetHighlightText("" - .."Short bars are 10 shorter Titan bars that the user can place and change width.\n" - .."- Short bars are independent. They may be used with or without the full width Titan bars.\n" - .."- Open Configuration > Bars to enable and change Bar options.\n" - .."- The default position is the top center under the full width bars. They will be stacked to not overlap.\n" - .."- Move : Use Shift + left mouse and dragging.\n" - .."- Change width by 1 : Use Shift + mouse wheel.\n" - .."- Change width by 10: Use Shift + Ctrl + mouse wheel.\n" - .."- When dragging, best to place your mouse over the left side padding before moving or changing width.\n" - .."- When dragging stops, if the Short Bar is beyond the screen edge the Short Bar should 'snap' to the edge.\n" - .."- Skin : Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n" - .."- Reset : In case a Short bar gets messed up, use Reset Position to place it at original position and width. This does not move plugins.\n" - .."- Min width : Left side padding plus one icon width.\n" - .."- Max width : Screen width.\n" - .."Limitations\n" - .."- There is no 'snap together' or grid for placing Short Bars.\n" - ) - .."\n\n" - ..TitanUtils_GetGreenText("All Bars: \n") - ..TitanUtils_GetHighlightText("" - .."- Bar Right click menu shows the name of the Bar in the menu title corresponding to configuration options.\n" - .."- Hide any Titan bar by using the Bar Right click menu then click Hide.\n" - .."- Titan does not restrict plugins to fit within the visible width. Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n" - .."- Setting a plugin to right-side will use the visible right side; and may overlap with left or center aligned plugins.\n" - .."- Skins : \n" - .."--- Select per Titan bar.\n" - .."--- Select a skin for all Titan bars. This does NOT change the individual Titan bar skin settings.\n" - .."- Hide in Combat : \n" - .."--- Select per Titan bar.\n" - .."--- Hide all Titan bars during combat. This does NOT change the individual Titan bar hide in combat settings.\n" - .."- Bar Order (English): Configuration > Bars shows localized Bar names.\n" - .."--- Top : Always top of screen\n" - .."--- Top 2 : Always under Top Bar\n" - .."--- Bottom 2 : Always above Bottom Bar\n" - .."--- Bottom : Always bottom of screen\n" - .."--- Short 01 - 10 : User placed\n" - ) - .."\n\n" - ..TitanUtils_GetGreenText("Plugins: \n") - ..TitanUtils_GetHighlightText("" - .."Show / Hide Plugins - use one of the methods below:\n" - .."--- Open the right-click Bar menu; find the plugin in a category then click to show / hide the plugin.\n" - .."--- Open Titan Configuration > Plugins then select the plugin by name then check / uncheck Show. If needed, use the Bar dropdown to select the Bar the plugin should be on.\n" - ) - ..TitanUtils_GetHighlightText("" - .."Moving Plugins - use one of the methods below:\n" - .."--- Open the right-click menu; find the plugin in a category then hide then show.\n" - .."--- Drag and drop on another bar or on the same bar.\n" - .."--- Drag and drop on another plugin to swap the plugins.\n" - .."--- Open Titan Configuration > Plugins then check / uncheck Show then use the Bar dropdown and Right / Left buttons.\n" - ) - .."\n\n" -end +--============= Profiles + --[[ local -NAME: helpBars -DESC: Help for the Titan Panel user -:DESC +NAME: optionsChars +DESC: This is the table shell. The toon info will be added by another routine. --]] -local helpBars = { - name = TITAN_PANEL_CONFIG.topic.help, +local optionsChars = { + name = TITAN_PANEL_CONFIG.topic.profiles, --"Titan "..L["TITAN_PANEL_MENU_PROFILES"], type = "group", - args = { - confgendesc = { - name = "Help", - order = 1, - type = "group", inline = true, - args = { - confdesc = { - order = 1, - type = "description", - name = help_text, - cmdHidden = true - }, - } - }, - } + args = {} } -------------- --- General Titan config section --[[ local -NAME: optionsFrames -DESC: Show the general Tian options that hte user can change: -Tooltips: -- Hide in combat -- Show (or not) -Frames (bars): -- Lock buttons (plugins) - do not allow plugins to be moved via drag & drop. Shift left / right is still allowwed. -- Show plugin versions - show the version in the tooltips -Actions: -- Force LDB laucnhers to right side - This will move all converted LDB plugins of type launcher to the right side of the Titan bar. -- Refresh plugins - This can be used when a plugin has not updated its text. It may allow a plugin to show if it is not visible but the user has selected show. -- Reset Titan to default - used when the user wants to reset Titan options to a fresh install state. No plugins are removed by this. -:DESC +NAME: TitanUpdateChars +DESC: Allow the user to delete toon data (just not the one they are logged into). +VAR: None +OUT: None +NOTE: +- Users can delete toons but the saved variable data is still stored by Titan. +- The old toon data can be removed by the user. +- This routine is called to 'redraw' the list as a user deletes toon data. +- A message is sent to chat that the plugin data has been deleted. +:NOTE --]] -local optionsFrames = { - name = TITAN_PANEL_CONFIG.topic.tooltips, --L["TITAN_PANEL_MENU_OPTIONS"], - type = "group", - args = { - confdesc2 = { - order = 200, - type = "header", - name = L["TITAN_PANEL_MENU_OPTIONS_TOOLTIPS"], - }, - optiontooltip = { - name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], --- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], - order = 201, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("ToolTipsShown") end, - set = function() TitanPanelToggleVar("ToolTipsShown"); end, - }, - optiontooltipcombat = { - name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], --- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], - order = 210, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("HideTipsInCombat") end, - set = function() TitanPanelToggleVar("HideTipsInCombat"); end, - }, - conftooltipdesc = { - name = "Tooltip Modifier", - type = "group", inline = true, - order = 220, - args = { - confdesc = { - order = 110, - type = "description", - name = "", - cmdHidden = true, - }, - advname = { - name = L["TITAN_PANEL_MENU_TOOLTIP_MOD"], - desc = "", -- L[""], - order = 120, type = "toggle", width = "full", - get = function() return TitanAllGetVar("UseTooltipModifer") end, - set = function(_, a) - TitanAllSetVar("UseTooltipModifer", a); - end, - }, - tooltipmod = { - name = "", - type = "group", inline = true, - order = 140, - args = { - alt_key = { - name = L["TITAN_KEY_ALT"], - desc = L["TITAN_KEY_ALT_DESC"], - order = 110, type = "toggle", --width = "full", - get = function() return TitanAllGetVar("TooltipModiferAlt") end, - set = function(_, a) - TitanAllSetVar("TooltipModiferAlt", a); - end, - }, - ctrl_key = { - name = L["TITAN_KEY_CTRL"], - desc = L["TITAN_KEY_CTRL_DESC"], - order = 120, type = "toggle", --width = "full", - get = function() return TitanAllGetVar("TooltipModiferCtrl") end, - set = function(_, a) - TitanAllSetVar("TooltipModiferCtrl", a); - end, - }, - shift_key = { - name = L["TITAN_KEY_SHIFT"], - desc = L["TITAN_KEY_SHIFT_DESC"], - order = 130, type = "toggle", --width = "full", - get = function() return TitanAllGetVar("TooltipModiferShift") end, - set = function(_, a) - TitanAllSetVar("TooltipModiferShift", a); - end, - }, - }, - }, - }, - }, - confdesc = { - order = 300, - type = "header", - name = L["TITAN_PANEL_MENU_OPTIONS_FRAMES"], - }, - optionlock = { - name = L["TITAN_PANEL_MENU_LOCK_BUTTONS"], - order = 301, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("LockButtons") end, - set = function() TitanPanelToggleVar("LockButtons") end, - }, - optionversions = { - name = L["TITAN_PANEL_MENU_VERSION_SHOWN"], - order = 302, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("VersionShown") end, - set = function() TitanPanelToggleVar("VersionShown") end, - }, - autohidelock = { - name = L["TITAN_PANEL_MENU_AUTOHIDE_IN_COMBAT"], - order = 303, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("LockAutoHideInCombat") end, - set = function() TitanPanelToggleVar("LockAutoHideInCombat") end, - }, - space_400_1 = { - order = 400, - type = "description", - name = " ", - cmdHidden = true, - }, - optionlaunchers = { - name = L["TITAN_PANEL_MENU_LDB_FORCE_LAUNCHER"], - order = 401, type = "execute", width = "full", - func = function() TitanPanelBarButton_ForceLDBLaunchersRight() end, - }, - space_500_1 = { - order = 500, - type = "description", - name = " ", - cmdHidden = true, - }, - pluginreset = { - name = L["TITAN_PANEL_MENU_PLUGIN_RESET"], - desc = L["TITAN_PANEL_MENU_PLUGIN_RESET_DESC"], - order = 501, type = "execute", width = "full", - func = function() TitanPanel_InitPanelButtons() end, - }, - space_600_1 = { - order = 600, - type = "description", - name = " ", - cmdHidden = true, - }, - optionreset = { - name = L["TITAN_PANEL_MENU_RESET"].." " - .._G["GREEN_FONT_COLOR_CODE"] - ..L["TITAN_PANEL_MENU_RELOADUI"], - order = 601, type = "execute", width = "full", - func = function() TitanPanel_ResetToDefault() end, - } - } - } -------------- +local function TitanUpdateChars() + local players = {}; + -- Rip through the players (with server name) to sort them + for index, id in pairs(TitanSettings.Players) do + table.insert(players, index); + end -------------- --- Bars Global config section -------------- -local optionsGlobals = { - name = TITAN_PANEL_CONFIG.topic.globals, - type = "group", - args = { - confdesc = { - order = 10, width = "full", - type = "header", - name = L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], - }, - setskinuseglobal = { - name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], - desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], - order = 15, type = "select", width = "full", - style = "radio", - get = function() return TitanBarDataVars["Global"].texure end, - set = function(_, v) - TitanBarDataVars["Global"].texure = v - for idx, val in pairs (TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - end, - values = { - [TitanVars.SKIN] = L["TITAN_SKINS_TITLE"], - [TitanVars.COLOR] = COLOR, - [TitanVars.NONE] = NONE, - }, - }, - confskindesc = { - order = 20, width = "full", - type = "description", - name = L["TITAN_SKINS_TITLE"], - }, - setskinglobal = { - order = 21, type = "select", width = "30", - name = " ", --L["TITAN_SKINS_LIST_TITLE"], - desc = L["TITAN_SKINS_SET_DESC"], - get = function() return TitanBarDataVars["Global"].skin.path end, - set = function(_,v) - TitanBarDataVars["Global"].skin.path = v --TitanPanelSetVar("TexturePath", v); - if TitanBarDataVars["Global"].texure == TitanVars.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] = "|cff19ff19"..v.name.."|r" - else - Skinlist[v.path] = "|cffffff9a"..v.name.."|r" - 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 = 30, width = "10", - }, - show_skin_global_top = { - type = "description", - name = "", - image = function() - return TitanBarDataVars["Global"].skin.path.."TitanPanelBackgroundTop0" --- return TitanPanelGetVar("TexturePath").."TitanPanelBackgroundTop0" - end, - imageWidth = 256, - order = 31, width = "60", - }, - confcolorspacer = { -- spacer - order = 50, type = "description", width = "full", - name = " ", - }, - confcolordesc = { - order = 51, 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 = 55, --- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), - hasAlpha = true, - get = function() - local color = TitanBarDataVars["Global"].color - return color.r, - color.g, - color.b, - color.alpha - end, - set = function(info, r, g, b, a) ---[===[ -print("Color new:" -.." "..tostring(format("%0.1f", r)).."" -.." "..tostring(format("%0.1f", g)).."" -.." "..tostring(format("%0.1f", b)).."" -.." "..tostring(format("%0.1f", 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 == TitanVars.COLOR then - for idx, val in pairs (TitanBarData) do - TitanPanel_SetBarTexture(idx) - end - end - end, - }, - hidecombatspacer = { -- spacer - order = 100, type = "description", width = "full", - name = " ", - }, - confcombatdesc = { - order = 101, width = "full", - type = "header", - name = L["TITAN_PANEL_MENU_COMMAND"], - }, - setcombatuseglobal = { - name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], - desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], - order = 105, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("HideBarsInCombat") end, - set = function() TitanPanelToggleVar("HideBarsInCombat"); end, - }, - arenaspacer = { -- spacer - order = 200, type = "description", width = "full", - name = " ", - }, - confarenadesc = { - order = 201, width = "full", - type = "header", - name = BATTLEGROUND.." / "..ARENA, - }, - 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 = 205, type = "toggle", width = "full", - get = function() return TitanPanelGetVar("HideBarsInPVP") end, - set = function() - TitanPanelToggleVar("HideBarsInPVP") - TitanPanelBarButton_DisplayBarsWanted("HideBarsInPVP" - .." "..tostring(TitanPanelGetVar("HideBarsInPVP"))) - end, - }, - } -} - -------------- --- attempted plugins config section ---[[ local -NAME: optionsAddonAttempts -DESC: This is the table shell. The plugin info will be added by another routine. ---]] -local optionsAddonAttempts = { - name = TITAN_PANEL_CONFIG.topic.attempts, --L["TITAN_PANEL_ATTEMPTS"], - type = "group", - args = {} -} - ---[[ local -NAME: TitanUpdateAddonAttempts -DESC: Show the each plugin that attempted to register with Titan. This can be used by plugin developers as the create / update plugins (Titan or LDB). It can also be used by user to attempt to figure out why a plugin is not shown or to report an issue to Titan. -VAR: None -OUT: None -NOTE: -- This is called after the plugins are registered in the 'player entering world' event. It can be called again as plugins registered. -- Any plugins that attempted to register (no child frames though) are shown. See the Titan Utils section for more details on plugin registration. -- This option page is for display only. The user can take not action. -:NOTE ---]] -local function TitanUpdateAddonAttempts() - local args = optionsAddonAttempts.args + -- set up the options for the user + local args = optionsChars.args local plug_in = nil wipe(args) args["desc"] = { - order = 0, + order = 1, type = "description", - name = L["TITAN_PANEL_ATTEMPTS_DESC"], + name = L["TITAN_PANEL_CHARS_DESC"].."\n", + cmdHidden = true, + } + args["custom_header"] = { + order = 10, + type = "header", + name = L["TITAN_PANEL_MENU_PROFILE_CUSTOM"].."\n", + cmdHidden = true, + } + args["custom_save"] = { + order = 11, + type = "execute", + name = L["TITAN_PANEL_MENU_SAVE_SETTINGS"].."\n", + func = function(info, v) + TitanPanel_SaveCustomProfile() + TitanUpdateChars() -- rebuild the toons + end, + } + args["sp_1"] = { + type = "description", + name = "", + cmdHidden = true, + order = 12, + } + args["global_header"] = { + order = 20, + type = "header", + name = L["TITAN_PANEL_GLOBAL"], + cmdHidden = true, + } + args["global_use"] = { + order = 21, type = "toggle", width = "full", + name = L["TITAN_PANEL_GLOBAL_USE"], + desc = L["TITAN_PANEL_GLOBAL_USE_DESC"], + get = function() return TitanAllGetVar("GlobalProfileUse") end, + set = function() + TitanUtils_SetGlobalProfile(not TitanAllGetVar("GlobalProfileUse"), nil) + TitanUpdateChars() -- rebuild the toons + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") + end, + } + args["global_name"] = { + order = 22, type = "description", width = "full", + name = L["TITAN_PANEL_GLOBAL_PROFILE"]..": "..TitanUtils_GetGoldText(TitanAllGetVar("GlobalProfileName") or "?"), + } + args["sp_20"] = { + type = "description", + name = "", + cmdHidden = true, + order = 23, + } + args["profile_header"] = { + order = 30, + type = "header", + name = L["TITAN_PANEL_MENU_PROFILES"].."\n", cmdHidden = true } - for idx, value in pairs(TitanPluginToBeRegistered) do - if TitanPluginToBeRegistered[idx] - then - local num = tostring(idx) - local button = TitanPluginToBeRegistered[idx].button - local name = (TitanPluginToBeRegistered[idx].name or "?") - local reason = TitanPluginToBeRegistered[idx].status - local issue = TitanPluginToBeRegistered[idx].issue - local notes = TitanPluginToBeRegistered[idx].notes or "" - local category = TitanPluginToBeRegistered[idx].category - local ptype = TitanPluginToBeRegistered[idx].plugin_type - local btype = TitanPanelButton_GetType(idx) - local title = TitanPluginToBeRegistered[idx].name - local isChild = TitanPluginToBeRegistered[idx].isChild and true or false - if reason ~= TITAN_REGISTERED then - title = TitanUtils_GetRedText(title) - issue = TitanUtils_GetRedText(issue) + for idx, value in pairs(players) do + local name = (players[idx] or "?") + local s, e, ident, server, player + local fancy_name = "" + local disallow = false + disallow = -- looks weird but we need to force a true or Ace complains + ((name == TitanSettings.Player) + or ((name == TitanAllGetVar("GlobalProfileName")) + and (TitanAllGetVar("GlobalProfileUse"))) + ) and true or false + + if name then + -- color code the name + -- - gold for normal profiles + -- - green for custom profiles + player, server = TitanUtils_ParseName(name) + -- handle custom profiles here + if server == TITAN_CUSTOM_PROFILE_POSTFIX then + fancy_name = TitanUtils_GetGreenText((name or "?")) + else + fancy_name = TitanUtils_GetGoldText((name or "?")) end - - if isChild then - -- Do not show. A child is part of (within) another plugin - -- showing it here would be confusing to the 'normal' user. - -- A plugin in author would know to look at the - -- TitanPluginToBeRegistered array directly. - else - args[num] = { - type = "group", - name = title, - order = idx, - args = { - name ={ - type = "description", - name = TitanUtils_GetGoldText("")..name, - cmdHidden = true, - order = 1, - }, - reason = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_STATUS"]..": ")..reason, - cmdHidden = true, - order = 2, - }, - issue = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_ISSUE"]..": \n")..issue, - cmdHidden = true, - order = 3, - }, - notes = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_NOTES"]..": \n")..notes, - cmdHidden = true, - order = 4, - }, - sp_1 = { - type = "description", - name = "", - cmdHidden = true, - order = 5, - }, - category = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_CATEGORY"]..": ")..category, - cmdHidden = true, - order = 10, - }, - ptype = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TYPE"]..": ")..ptype, --.." "..btype, - cmdHidden = true, - order = 11, - }, - button = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_BUTTON"]..": ")..button, - cmdHidden = true, - order = 12, - }, - num_val = { - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TABLE"]..": ")..num, - cmdHidden = true, - order = 13, - }, - } - } - end - end - end - - -- Config Tables changed! - AceConfigRegistry:NotifyChange(L["TITAN_PANEL"]) -end -------------- - -------------- --- extra plugins config section ---[[ local -NAME: optionsExtras -DESC: This is the table shell. The plugin info will be added by another routine. ---]] -local optionsExtras = { - name = TITAN_PANEL_CONFIG.topic.extras, --L["TITAN_PANEL_EXTRAS"], - type = "group", - args = {} -} - ---[[ local -NAME: TitanUpdateAddonAttempts -DESC: Show plugins that are not registered (loaded) but have config data. The data can be deleted by the user. -VAR: None -OUT: None -NOTE: -- As users change the plugins they use the old ones still have saved variable data stored by Titan. -- The old plugin data can be removed by the user when they will not longer use that plugin. -- This routine is called to 'redraw' the list as a user deletes data. -- A message is sent to chat that the plugin data has been deleted. -:NOTE ---]] -local function TitanUpdateExtras() - local args = optionsExtras.args - local plug_in = nil - - wipe(args) - - args["desc"] = { - order = 1, - type = "description", - name = L["TITAN_PANEL_EXTRAS_DESC"].."\n", - cmdHidden = true - } - for idx, value in pairs(TitanPluginExtras) do - if TitanPluginExtras[idx] then - local num = TitanPluginExtras[idx].num - local name = TitanPluginExtras[idx].id + -- end color code args[name] = { type = "group", - name = TitanUtils_GetGoldText(tostring(num)..": "..(name or "?")), - order = idx, + name = fancy_name, + desc = "", + order = 40, args = { name = { - type = "description", + type = "header", name = TitanUtils_GetGoldText(name or "?"), cmdHidden = true, order = 10, }, + sp_1 = { + type = "description", + name = "", + cmdHidden = true, + order = 11, + }, + optionload = { + name = L["TITAN_PANEL_MENU_LOAD_SETTINGS"], + order = 20, type = "execute", width = "full", + func = function(info, v) + TitanVariables_UseSettings(info[1], TITAN_PROFILE_USE) + end, + -- does not make sense to load current character profile or global profile + disabled = disallow, + }, + sp_20 = { + type = "description", + name = "", + cmdHidden = true, + order = 21, + }, optionreset = { - name = L["TITAN_PANEL_EXTRAS_DELETE_BUTTON"], - order = 15, type = "execute", width = "full", + name = L["TITAN_PANEL_MENU_DELETE_SETTINGS"], + order = 30, type = "execute", width = "full", func = function(info, v) - TitanPluginSettings[info[1]] = nil -- delete the config entry + TitanSettings.Players[info[1]] = nil -- delete the config entry TitanPrint( - " '"..info[1].."' "..L["TITAN_PANEL_EXTRAS_DELETE_MSG"] + L["TITAN_PANEL_MENU_PROFILE"] + ..info[1] + ..L["TITAN_PANEL_MENU_PROFILE_DELETED"] , "info") - TitanVariables_ExtraPluginSettings() -- rebuild the list - TitanUpdateExtras() -- rebuild the options config - AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") -- tell Ace to redraw + if name == TitanAllGetVar("GlobalProfileName") then + TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) + end + TitanUpdateChars() -- rebuild the toons + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") end, + -- can not delete current character profile or global profile + disabled = disallow, }, - } + sp_30 = { + type = "description", + name = "", + cmdHidden = true, + order = 31, + }, + sp_31 = { + type = "description", + name = "", + cmdHidden = true, + order = 32, + }, + global_header = { + order = 40, + type = "header", + name = "Global", --L["TITAN_PANEL_MENU_VERSION_SHOWN"], + cmdHidden = true, + }, + use_as_global = { + order = 41, type = "toggle", width = "full", + name = L["TITAN_PANEL_GLOBAL_USE_AS"], + get = function() return TitanPanelGetVar("GlobalProfileName") == name end, + set = function() + if TitanPanelGetVar("GlobalProfileName") == name then + -- Was unchecked so clear the saved var + TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) + else + -- Was checked so set the saved var + TitanAllSetVar("GlobalProfileName", name) + end + if TitanAllGetVar("GlobalProfileUse") then + -- Use whatever toon the user picked, if not use current toon + if TitanAllGetVar("GlobalProfileName") == TITAN_PROFILE_NONE then + TitanAllSetVar("GlobalProfileName", TitanSettings.Player) + end + TitanVariables_UseSettings(TitanAllGetVar("GlobalProfileName"), TITAN_PROFILE_USE) + TitanPrint( + L["TITAN_PANEL_MENU_PROFILE"] + ..":"..(TitanAllGetVar("GlobalProfileName") or "?") + ..": "..L["TITAN_PANEL_GLOBAL_RESET_PART"].."..." + , "info") + else + -- + end + TitanUpdateChars() + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") + end, + -- can not uncheck current global profile + disabled = disallow, + }, + sp_40 = { + type = "description", + name = "", + cmdHidden = true, + order = 42, + }, + }, } end end - - AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") + + -- tell the options screen there is a new list + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") end ------------- +--============= Tooltips and Frames + --[[ local -NAME: optionsChars -DESC: This is the table shell. The toon info will be added by another routine. +NAME: optionsFrames +DESC: Show the general Tian options that hte user can change: +Tooltips: +- Hide in combat +- Show (or not) +Frames (bars): +- Lock buttons (plugins) - do not allow plugins to be moved via drag & drop. Shift left / right is still allowwed. +- Show plugin versions - show the version in the tooltips +Actions: +- Force LDB laucnhers to right side - This will move all converted LDB plugins of type launcher to the right side of the Titan bar. +- Refresh plugins - This can be used when a plugin has not updated its text. It may allow a plugin to show if it is not visible but the user has selected show. +- Reset Titan to default - used when the user wants to reset Titan options to a fresh install state. No plugins are removed by this. +:DESC --]] -local optionsChars = { - name = TITAN_PANEL_CONFIG.topic.profiles, --"Titan "..L["TITAN_PANEL_MENU_PROFILES"], +local optionsFrames = { + name = TITAN_PANEL_CONFIG.topic.tooltips, --L["TITAN_PANEL_MENU_OPTIONS"], type = "group", - args = {} -} - ---[[ local -NAME: TitanUpdateChars -DESC: Allow the user to delete toon data (just not the one they are logged into). -VAR: None -OUT: None -NOTE: -- Users can delete toons but the saved variable data is still stored by Titan. -- The old toon data can be removed by the user. -- This routine is called to 'redraw' the list as a user deletes toon data. -- A message is sent to chat that the plugin data has been deleted. -:NOTE ---]] -local function TitanUpdateChars() - local players = {}; - -- Rip through the players (with server name) to sort them - for index, id in pairs(TitanSettings.Players) do - table.insert(players, index); - end - - -- set up the options for the user - local args = optionsChars.args - local plug_in = nil + args = { + confdesc2 = { + order = 200, + type = "header", + name = L["TITAN_PANEL_MENU_OPTIONS_TOOLTIPS"], + }, + optiontooltip = { + name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], +-- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], + order = 201, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("ToolTipsShown") end, + set = function() TitanPanelToggleVar("ToolTipsShown"); end, + }, + optiontooltipcombat = { + name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], +-- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], + order = 210, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideTipsInCombat") end, + set = function() TitanPanelToggleVar("HideTipsInCombat"); end, + }, + conftooltipdesc = { + name = "Tooltip Modifier", + type = "group", inline = true, + order = 220, + args = { + confdesc = { + order = 110, + type = "description", + name = "", + cmdHidden = true, + }, + advname = { + name = L["TITAN_PANEL_MENU_TOOLTIP_MOD"], + desc = "", -- L[""], + order = 120, type = "toggle", width = "full", + get = function() return TitanAllGetVar("UseTooltipModifer") end, + set = function(_, a) + TitanAllSetVar("UseTooltipModifer", a); + end, + }, + tooltipmod = { + name = "", + type = "group", inline = true, + order = 140, + args = { + alt_key = { + name = L["TITAN_KEY_ALT"], + desc = L["TITAN_KEY_ALT_DESC"], + order = 110, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferAlt") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferAlt", a); + end, + }, + ctrl_key = { + name = L["TITAN_KEY_CTRL"], + desc = L["TITAN_KEY_CTRL_DESC"], + order = 120, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferCtrl") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferCtrl", a); + end, + }, + shift_key = { + name = L["TITAN_KEY_SHIFT"], + desc = L["TITAN_KEY_SHIFT_DESC"], + order = 130, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferShift") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferShift", a); + end, + }, + }, + }, + }, + }, + confdesc = { + order = 300, + type = "header", + name = L["TITAN_PANEL_MENU_OPTIONS_FRAMES"], + }, + optionlock = { + name = L["TITAN_PANEL_MENU_LOCK_BUTTONS"], + order = 301, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("LockButtons") end, + set = function() TitanPanelToggleVar("LockButtons") end, + }, + optionversions = { + name = L["TITAN_PANEL_MENU_VERSION_SHOWN"], + order = 302, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("VersionShown") end, + set = function() TitanPanelToggleVar("VersionShown") end, + }, + autohidelock = { + name = L["TITAN_PANEL_MENU_AUTOHIDE_IN_COMBAT"], + order = 303, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("LockAutoHideInCombat") end, + set = function() TitanPanelToggleVar("LockAutoHideInCombat") end, + }, + space_400_1 = { + order = 400, + type = "description", + name = " ", + cmdHidden = true, + }, + optionlaunchers = { + name = L["TITAN_PANEL_MENU_LDB_FORCE_LAUNCHER"], + order = 401, type = "execute", width = "full", + func = function() TitanPanelBarButton_ForceLDBLaunchersRight() end, + }, + space_500_1 = { + order = 500, + type = "description", + name = " ", + cmdHidden = true, + }, + pluginreset = { + name = L["TITAN_PANEL_MENU_PLUGIN_RESET"], + desc = L["TITAN_PANEL_MENU_PLUGIN_RESET_DESC"], + order = 501, type = "execute", width = "full", + func = function() TitanPanel_InitPanelButtons() end, + }, + space_600_1 = { + order = 600, + type = "description", + name = " ", + cmdHidden = true, + }, + optionreset = { + name = L["TITAN_PANEL_MENU_RESET"].." " + .._G["GREEN_FONT_COLOR_CODE"] + ..L["TITAN_PANEL_MENU_RELOADUI"], + order = 601, type = "execute", width = "full", + func = function() TitanPanel_ResetToDefault() end, + } + } + } +------------- - wipe(args) +--============= Scale and Font - args["desc"] = { - order = 1, - type = "description", - name = L["TITAN_PANEL_CHARS_DESC"].."\n", - cmdHidden = true, - } - args["custom_header"] = { - order = 10, - type = "header", - name = L["TITAN_PANEL_MENU_PROFILE_CUSTOM"].."\n", - cmdHidden = true, - } - args["custom_save"] = { - order = 11, - type = "execute", - name = L["TITAN_PANEL_MENU_SAVE_SETTINGS"].."\n", - func = function(info, v) - TitanPanel_SaveCustomProfile() - TitanUpdateChars() -- rebuild the toons - end, - } - args["sp_1"] = { - type = "description", - name = "", - cmdHidden = true, - order = 12, - } - args["global_header"] = { - order = 20, - type = "header", - name = L["TITAN_PANEL_GLOBAL"], - cmdHidden = true, - } - args["global_use"] = { - order = 21, type = "toggle", width = "full", - name = L["TITAN_PANEL_GLOBAL_USE"], - desc = L["TITAN_PANEL_GLOBAL_USE_DESC"], - get = function() return TitanAllGetVar("GlobalProfileUse") end, - set = function() - TitanUtils_SetGlobalProfile(not TitanAllGetVar("GlobalProfileUse"), nil) - TitanUpdateChars() -- rebuild the toons - AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") - end, - } - args["global_name"] = { - order = 22, type = "description", width = "full", - name = L["TITAN_PANEL_GLOBAL_PROFILE"]..": "..TitanUtils_GetGoldText(TitanAllGetVar("GlobalProfileName") or "?"), - } - args["sp_20"] = { - type = "description", - name = "", - cmdHidden = true, - order = 23, - } - args["profile_header"] = { - order = 30, - type = "header", - name = L["TITAN_PANEL_MENU_PROFILES"].."\n", +--[[ local +NAME: optionsUIScale +DESC: Local table to hold the Titan options that allow a user to adjust: +- UI scale +- Titan scale for bars +- Spacing between Titan plugins (right side) +- Spacing between Titan icons (left side) +- Titan tooltip font scale (bar and plugins) +- Toggle the tooltip font scale (allow Titan or Blizz to control) +- Set Titan font (bar and plugins) +- Set Titan font size +- Set Titan bar strata (tells Blizz which frames could go over Titan bar (and plugins) +:DESC +--]] +local optionsUIScale = { + name = TITAN_PANEL_CONFIG.topic.scale, --L["TITAN_UISCALE_MENU_TEXT"], + type = "group", + args = { + confdesc = { + order = 1, + type = "description", + name = L["TITAN_UISCALE_MENU_DESC"].."\n", + cmdHidden = true + }, + uiscale = { + name = L["TITAN_UISCALE_CONTROL_TITLE_UI"], + desc = L["TITAN_UISCALE_SLIDER_DESC"], + order = 2, type = "range", width = "full", + min = 0.64, max = 1, step = 0.01, + get = function() return UIParent:GetScale() end, + set = function(_, a) + SetCVar("useUiScale", 1); + SetCVar("uiScale", a, "uiScale"); + end, + }, + panelscale = { + name = L["TITAN_UISCALE_CONTROL_TITLE_PANEL"], + desc = L["TITAN_UISCALE_PANEL_SLIDER_DESC"], + order = 3, type = "range", width = "full", + min = 0.75, max = 1.25, step = 0.01, + get = function() return TitanPanelGetVar("Scale") end, + set = function(_, a) + TitanPanelSetVar("Scale", a) +-- TitanPanel_SetScale() + TitanPanel_InitPanelBarButton("Config scale change "..a) + end, + disabled = function() + if InCombatLockdown() then + return true + else + return false + end + end, + }, + buttonspacing = { + name = L["TITAN_UISCALE_CONTROL_TITLE_BUTTON"], + desc = L["TITAN_UISCALE_BUTTON_SLIDER_DESC"], + order = 4, type = "range", width = "full", + min = 5, max = 80, step = 1, + get = function() return TitanPanelGetVar("ButtonSpacing") end, + set = function(_, a) + TitanPanelSetVar("ButtonSpacing", a); + TitanPanel_InitPanelButtons(); + end, + }, + iconspacing = { -- right side plugins + name = L["TITAN_UISCALE_CONTROL_TITLE_ICON"], + desc = L["TITAN_UISCALE_ICON_SLIDER_DESC"], + order = 5, type = "range", width = "full", + min = 0, max = 20, step = 1, + get = function() return TitanPanelGetVar("IconSpacing") end, + set = function(_, a) + TitanPanelSetVar("IconSpacing", a); + TitanPanel_InitPanelButtons(); + end, + }, + spacer01 = { + type = "description", + name = "\n\n", imageHeight = 0, + order = 10, width = "full", + }, + tooltipdesc = { + order = 20, width = "full", + type = "header", + name = "Tooltip", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + tooltipfont = { + name = L["TITAN_UISCALE_CONTROL_TOOLTIP_TOOLTIPFONT"], + desc = L["TITAN_UISCALE_TOOLTIP_SLIDER_DESC"], + order = 21, type = "range", width = "full", + min = 0.5, max = 1.3, step = 0.01, + get = function() return TitanPanelGetVar("TooltipFont") end, + set = function(_, a) + TitanPanelSetVar("TooltipFont", a); + end, + }, + tooltipfontdisable = { + name = L["TITAN_UISCALE_TOOLTIP_DISABLE_TEXT"], + desc = L["TITAN_UISCALE_DISABLE_TOOLTIP_DESC"], + order = 22, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("DisableTooltipFont") end, + set = function() + TitanPanelToggleVar("DisableTooltipFont"); + end, + }, + fontdesc = { + order = 30, width = "full", + type = "header", + name = "Font", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + fontselection = { + name = L["TITAN_PANEL_MENU_LSM_FONTS"], + desc = L["TITAN_PANEL_MENU_LSM_FONTS_DESC"], + order = 31, type = "select", width = "40", + dialogControl = "LSM30_Font", + get = function() + return TitanPanelGetVar("FontName") + end, + set = function(_, v) + TitanPanelSetVar("FontName", v) + TitanSetPanelFont(v, TitanPanelGetVar("FontSize")) + end, + values = AceGUIWidgetLSMlists.font, + }, + fontspacer = { + order = 32, type = "description", width = "20", + name = " ", + }, + fontsize = { + name = L["TITAN_PANEL_MENU_FONT_SIZE"], + desc = L["TITAN_PANEL_MENU_FONT_SIZE_DESC"], + order = 33, type = "range", width = "40", + min = 7, max = 15, step = 1, + get = function() return TitanPanelGetVar("FontSize") end, + set = function(_, v) + TitanPanelSetVar("FontSize", v); + TitanSetPanelFont(TitanPanelGetVar("FontName"), v) + end, + }, + paneldesc = { + order = 40, width = "full", + type = "header", + name = "Strata", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + panelstrata = { + name = L["TITAN_PANEL_MENU_FRAME_STRATA"], + desc = L["TITAN_PANEL_MENU_FRAME_STRATA_DESC"], + order = 41, type = "select", + get = function() + return TitanPanelGetVar("FrameStrata") + end, + set = function(_, v) + TitanPanelSetVar("FrameStrata", v) + TitanVariables_SetPanelStrata(v) + end, + values = { + ["BACKGROUND"] = "BACKGROUND", + ["LOW"] = "LOW", + ["MEDIUM"] = "MEDIUM", + ["HIGH"] = "HIGH", + ["DIALOG"] = "DIALOG", + ["FULLSCREEN"] = "FULLSCREEN", + }, + }, + panelstrataorder = { + order = 42, + type = "description", + name = "Order of Strata\n" + .."- BACKGROUND\n" + .."- LOW - default\n" + .."- MEDIUM\n" + .."- HIGH\n" + .."- DIALOG\n" + .."- FULLSCREEN\n", cmdHidden = true + }, } - for idx, value in pairs(players) do - local name = (players[idx] or "?") - local s, e, ident, server, player - local fancy_name = "" - local disallow = false - disallow = -- looks weird but we need to force a true or Ace complains - ((name == TitanSettings.Player) - or ((name == TitanAllGetVar("GlobalProfileName")) - and (TitanAllGetVar("GlobalProfileUse"))) - ) and true or false +} +------------- - if name then - -- color code the name - -- - gold for normal profiles - -- - green for custom profiles - player, server = TitanUtils_ParseName(name) - -- handle custom profiles here - if server == TITAN_CUSTOM_PROFILE_POSTFIX then - fancy_name = TitanUtils_GetGreenText((name or "?")) - else - fancy_name = TitanUtils_GetGoldText((name or "?")) - end - -- end color code - args[name] = { - type = "group", - name = fancy_name, - desc = "", - order = 40, - args = { - name = { - type = "header", - name = TitanUtils_GetGoldText(name or "?"), - cmdHidden = true, - order = 10, - }, - sp_1 = { - type = "description", - name = "", - cmdHidden = true, - order = 11, - }, - optionload = { - name = L["TITAN_PANEL_MENU_LOAD_SETTINGS"], - order = 20, type = "execute", width = "full", - func = function(info, v) - TitanVariables_UseSettings(info[1], TITAN_PROFILE_USE) - end, - -- does not make sense to load current character profile or global profile - disabled = disallow, - }, - sp_20 = { - type = "description", - name = "", - cmdHidden = true, - order = 21, - }, - optionreset = { - name = L["TITAN_PANEL_MENU_DELETE_SETTINGS"], - order = 30, type = "execute", width = "full", - func = function(info, v) - TitanSettings.Players[info[1]] = nil -- delete the config entry - TitanPrint( - L["TITAN_PANEL_MENU_PROFILE"] - ..info[1] - ..L["TITAN_PANEL_MENU_PROFILE_DELETED"] - , "info") - if name == TitanAllGetVar("GlobalProfileName") then - TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) - end - TitanUpdateChars() -- rebuild the toons - AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") - end, - -- can not delete current character profile or global profile - disabled = disallow, - }, - sp_30 = { - type = "description", - name = "", - cmdHidden = true, - order = 31, - }, - sp_31 = { - type = "description", - name = "", - cmdHidden = true, - order = 32, - }, - global_header = { - order = 40, - type = "header", - name = "Global", --L["TITAN_PANEL_MENU_VERSION_SHOWN"], - cmdHidden = true, - }, - use_as_global = { - order = 41, type = "toggle", width = "full", - name = L["TITAN_PANEL_GLOBAL_USE_AS"], - get = function() return TitanPanelGetVar("GlobalProfileName") == name end, - set = function() - if TitanPanelGetVar("GlobalProfileName") == name then - -- Was unchecked so clear the saved var - TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) - else - -- Was checked so set the saved var - TitanAllSetVar("GlobalProfileName", name) - end - if TitanAllGetVar("GlobalProfileUse") then - -- Use whatever toon the user picked, if not use current toon - if TitanAllGetVar("GlobalProfileName") == TITAN_PROFILE_NONE then - TitanAllSetVar("GlobalProfileName", TitanSettings.Player) - end - TitanVariables_UseSettings(TitanAllGetVar("GlobalProfileName"), TITAN_PROFILE_USE) - TitanPrint( - L["TITAN_PANEL_MENU_PROFILE"] - ..":"..(TitanAllGetVar("GlobalProfileName") or "?") - ..": "..L["TITAN_PANEL_GLOBAL_RESET_PART"].."..." - , "info") - else - -- - end - TitanUpdateChars() - AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") - end, - -- can not uncheck current global profile - disabled = disallow, - }, - sp_40 = { - type = "description", - name = "", - cmdHidden = true, - order = 42, - }, - }, +--============= Skins + +--[[ local +NAME: optionsSkins +DESC: Local table to hold the Titan skins options. Shows default Titan and any custom skins the user has added. +--]] +local optionsSkins = { + name = TITAN_PANEL_CONFIG.topic.skins, + type = "group", + args = { } - end +} + +local function Show_Skins(t, position) +--[[ + table.sort(TitanSkins, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) +--]] + local skin = "Skin" + for idx, v in pairs (TitanSkins) do + + position = position + 1 -- spacer + t[skin..position] = { + type = "header", + name = "", + order = position, width = "full", + } + + position = position + 1 -- Name of skin (col 1) + t[skin..position] = { + type = "description", + name = "|cff19ff19"..v.name.."|r", + order = position, width = "30", + } + + position = position + 1 -- Top image (col 2) + t[skin..position] = { + type = "description", + name = "", + image = v.path.."TitanPanelBackgroundTop0", + imageWidth = 256, + order = position, width = "50", + } + + position = position + 1 -- spacer + t[skin..position] = { + type = "description", + name = "", imageHeight = 0, + order = position, width = "full", + } + + position = position + 1 -- Bottom (col 1) + t[skin..position] = { + type = "description", + name = "", + order = position, width = "30", + } + position = position + 1 -- Bottom image (col 2) + t[skin..position] = { + type = "description", + name = "", + image = v.path.."TitanPanelBackgroundBottom0", + imageWidth = 256, + order = position, width = "50", + } + + position = position + 1 -- final spacer - bottom of config + t[skin..position] = { + type = "description", + name = "", imageHeight = 0, + order = position, width = "full", + } end + + position = position + 1 -- final spacer - bottom of config + t[skin..position] = { + type = "description", + name = "", + order = position, width = "full", + } +end - -- tell the options screen there is a new list - AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") +local function BuildSkins() + optionsSkins.args = {} + + Show_Skins(optionsSkins.args, 100) -- the current list of skins with images + AceConfigRegistry:NotifyChange("Titan Panel Skin Control") end -------------- -------------- --- plugin control config section +--============= Skins - Custom + --[[ local -NAME: optionsAddons -DESC: This is the table shell. The plugin controls will be added by another routine. +NAME: TitanPanel_AddNewSkin +DESC: Add each skin to the options list. If the user had added custom skins these will be shown as well. +VAR: skinname - the file name to use +VAR: skinpath - the file path to use +OUT: None +NOTE: +- Blizz *does not allow* LUA to access the user file system dynamically so the skins have to be input by hand. Titan can not search for available skins in the Artwork folder. +- On the flip side a user can add a custom skin to the Titan saved variables then later delete the skin from the file system. This will not cause an error when the user tries to use (show) that skin but Titan will show a 'blank' skin. +:NOTE --]] -local optionsAddons = { - name = TITAN_PANEL_CONFIG.topic.plugins, --"Titan "..L["TITAN_PANEL_MENU_PLUGINS"], - type = "group", - args = {} -} +local function TitanPanel_AddNewSkin(skinname, skinpath) + -- name and path must be provided + if not skinname or not skinpath then return end + + -- name cannot be empty or "None", path cannot be empty + if skinname == "" or skinname == L["TITAN_NONE"] or skinpath == "" then + return + end + + -- Assume the skin is already in the Titan saved variables list + local found + for _,i in pairs(TitanSkins) do + if i.name == skinname or i.path == skinpath then + found = true + break + end + end -local function ColorVisible(id, name) - local res = "?" - if TitanPanel_IsPluginShown(id) then - res = (name or "") - else - res = "|cff808080"..name.._G["FONT_COLOR_CODE_CLOSE"] + -- The skin is new so add it to the Titan saved variables list + if not found then + table.insert(TitanSkins, {name = skinname, path = skinpath }) end - return res + BuildSkins() + end --[[ local -NAME: TitanUpdateConfigAddons -DESC: Allow the user to control each plugin registered to Titan. -Controls honored from the plugin .registry: -- Show -- Show label text -- Right side -- Show icon -- Show text -Position: -- Shift left one plugin position on the bar -- Shift right one plugin position on the bar -- The shift is on the same bar -- The shift will not move a plugin from one side to the other -Bar: -- Drop down so the user can pick the bar the plugin is to be shown on. -- The list contains only the bars the user has selected to be shown. -- The user can not move a plugin to a hidden bar to 'hide' it. The user should ensure "Show Plugin" is unchecked. +NAME: optionsSkinsCustom +DESC: Local table to hold the Titan custom skins options that allow a user to add or delete skins. +- You may not remove the currently used skin +- or the default one +- or a Titan default skin (it would only come back...) :DESC -VAR: None -OUT: None --]] -local function TitanUpdateConfigAddons() - local args = optionsAddons.args - local plug_in = nil - local plug_version = "" - - wipe(args) - - for idx, value in pairs(TitanPluginsIndex) do - plug_in = TitanUtils_GetPlugin(TitanPluginsIndex[idx]) - if plug_in then - if plug_in.version then - plug_version = TitanUtils_GetGreenText(" ("..plug_in.version..")") - else - plug_version = "" - end - args[plug_in.id] = { - type = "group", - name = ColorVisible(plug_in.id, plug_in.menuText or ""), - order = idx, - args = { - name = { - type = "header", - name = ((plug_in.menuText or "")..plug_version), - order = 1, - }, - show = { - type = "toggle", - name = L["TITAN_PANEL_MENU_SHOW"], - order = 3, - get = function(info) return (TitanPanel_IsPluginShown(info[1])) end, - set = function(info, v) - local name = info[1] - if v then -- Show / add - local bar = (TitanGetVar(name, "ForceBar") or TitanUtils_PickBar()) - TitanUtils_AddButtonOnBar(bar, name) - else -- Hide / remove - TitanPanel_RemoveButton(name) - end - TitanUpdateConfigAddons() - end, - }, - } - } - - --ShowIcon - if plug_in.controlVariables and plug_in.controlVariables.ShowIcon then - args[plug_in.id].args.icon = - { - type = "toggle", - name = L["TITAN_PANEL_MENU_SHOW_ICON"], - order = 4, - get = function(info) return (TitanGetVar(info[1], "ShowIcon")) end, - set = function(info, v) - TitanToggleVar(info[1], "ShowIcon"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - - --ShowLabel - if plug_in.controlVariables and plug_in.controlVariables.ShowLabelText then - args[plug_in.id].args.label = { - type = "toggle", - name = L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"], - order = 5, - get = function(info) return (TitanGetVar(info[1], "ShowLabelText")) end, - set = function(info, v) - TitanToggleVar(info[1], "ShowLabelText"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - - --ShowRegularText (LDB data sources only atm) - if plug_in.controlVariables and plug_in.controlVariables.ShowRegularText then - args[plug_in.id].args.regular_text = - { - type = "toggle", - name = L["TITAN_PANEL_MENU_SHOW_PLUGIN_TEXT"], - order = 6, - get = function(info) return (TitanGetVar(info[1], "ShowRegularText")) end, - set = function(info, v) - TitanToggleVar(info[1], "ShowRegularText"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - - --ShowColoredText - if plug_in.controlVariables and plug_in.controlVariables.ShowColoredText then - args[plug_in.id].args.color_text = { - type = "toggle", - name = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"], - order = 7, - get = function(info) return (TitanGetVar(info[1], "ShowColoredText")) end, - set = function(info, v) - TitanToggleVar(info[1], "ShowColoredText"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end +local optionsSkinsCustom = { + name = TITAN_PANEL_CONFIG.topic.skinscust, --L["TITAN_SKINS_TITLE_CUSTOM"], + type = "group", + args = { + confdesc = { + order = 1, + type = "description", + name = L["TITAN_SKINS_MAIN_DESC"].."\n", + cmdHidden = true + }, + nulloption1 = { + order = 5, + type = "description", + name = " ", + cmdHidden = true + }, + addskinheader = { + order = 10, + type = "header", + name = L["TITAN_SKINS_NEW_HEADER"], + }, + newskinname = { + order = 11, + name = L["TITAN_SKINS_NAME_TITLE"], + desc = L["TITAN_SKINS_NAME_DESC"], + type = "input", width = "full", + get = function() return TitanSkinName end, + set = function(_,v) TitanSkinName = v end, + }, + newskinpath = { + order = 12, + name = L["TITAN_SKINS_PATH_TITLE"], + desc = L["TITAN_SKINS_PATH_DESC"], + type = "input", width = "full", + get = function() return TitanSkinPath end, + set = function(_,v) TitanSkinPath = TitanSkinsCustomPath..v..TitanSkinsPathEnd end, - -- Right-side plugin - if plug_in.controlVariables and plug_in.controlVariables.DisplayOnRightSide then - args[plug_in.id].args.right_side = { - type = "toggle", - name = L["TITAN_PANEL_MENU_LDB_SIDE"], - order = 8, - get = function(info) return (TitanGetVar(info[1], "DisplayOnRightSide")) end, - set = function(info, v) - local bar = TitanUtils_GetWhichBar(info[1]) - TitanToggleVar(info[1], "DisplayOnRightSide"); - TitanPanel_RemoveButton(info[1]); - TitanUtils_AddButtonOnBar(bar, info[1]); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - -- Shift R / L - args[plug_in.id].args.plugin_position = { - order = 50, - type = "header", - name = L["TITAN_PANEL_MENU_POSITION"], - } - args[plug_in.id].args.shift_left = { - type = "execute", - name = "< "..L["TITAN_PANEL_SHIFT_LEFT"].." ", - order = 51, - func = function(info, arg1) - local name = info[1] - if TitanPanel_IsPluginShown(name) then - TitanUtils_ShiftButtonOnBarLeft(name) + }, + addnewskin = { + order = 13, + name = L["TITAN_SKINS_ADD_HEADER"], type = "execute", + desc = L["TITAN_SKINS_ADD_DESC"], + func = function() + if TitanSkinName ~= "" and TitanSkinPath ~= "" then + TitanPanel_AddNewSkin(TitanSkinName, TitanSkinPath) + TitanSkinName = "" + TitanSkinPath = "" + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") + end + end, + }, + nulloption2 = { + order = 14, + type = "description", + name = " ", + cmdHidden = true + }, + removeskinheader = { + order = 20, + type = "header", + name = L["TITAN_SKINS_REMOVE_HEADER"], + }, + removeskinlist = { + order = 21, type = "select", width = "full", + name = L["TITAN_SKINS_REMOVE_HEADER"], + desc = L["TITAN_SKINS_REMOVE_DESC"], + get = function() return TitanSkinToRemove end, + set = function(_,v) + TitanSkinToRemove = v + end, + values = function() + local Skinlist = {} + local v; + for _,v in pairs (TitanSkins) do + if v.path ~= TitanPanelGetVar("TexturePath") + and v.path ~= "Interface\\AddOns\\Titan\\Artwork\\" + and v.titan ~= true + then + Skinlist[v.path] = "|cff19ff19"..v.name.."|r" + end + if v.path == TitanSkinToRemove then + Skinlist[v.path] = "|cffffff9a"..v.name.."|r" end - end, - } - args[plug_in.id].args.shift_right = { - type = "execute", - name = "> "..L["TITAN_PANEL_SHIFT_RIGHT"], - order = 52, - func = function(info, arg1) - local name = info[1] - if TitanPanel_IsPluginShown(info[1]) then - TitanUtils_ShiftButtonOnBarRight(name) + end + if TitanSkinToRemove ~= "None" then + Skinlist["None"] = "|cff19ff19"..L["TITAN_NONE"].."|r" + else + Skinlist["None"] = "|cffffff9a"..L["TITAN_NONE"].."|r" + end + table.sort(Skinlist, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) + return Skinlist + end, + }, + removeskin = { + order = 22, type = "execute", + name = L["TITAN_SKINS_REMOVE_BUTTON"], + desc = L["TITAN_SKINS_REMOVE_BUTTON_DESC"], + func = function() + if TitanSkinToRemove == "None" then return end + local k, v; + for k, v in pairs (TitanSkins) do + if v.path == TitanSkinToRemove then + table.remove(TitanSkins, k) + TitanSkinToRemove = "None" + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") + break end + end + end, + }, + nulloption4 = { + order = 24, + type = "description", + name = " ", + cmdHidden = true + }, + resetskinhdear = { + order = 200, + type = "header", + name = L["TITAN_SKINS_RESET_HEADER"], + }, + defaultskins = { + order = 201, + name = L["TITAN_SKINS_RESET_DEFAULTS_TITLE"], type = "execute", + desc = L["TITAN_SKINS_RESET_DEFAULTS_DESC"], + func = function() + TitanSkins = TitanSkinsDefault; + BuildSkins() end, - } - args[plug_in.id].args.space_50_1 = { - order = 53, - type = "header", - name = L["TITAN_PANEL_MENU_BAR"], - } - if not TitanVarExists(plug_in.id, "ForceBar") then - args[plug_in.id].args.top_bottom = { - order = 54, type = "select", - name = L["TITAN_PANEL_MENU_BAR"], - desc = L["TITAN_PANEL_MENU_DISPLAY_ON_BAR"], - get = function(info) - return TitanUtils_GetWhichBar(info[1]) end, - set = function(info,v) - local name = info[1] - if TitanPanel_IsPluginShown(name) then - TitanUtils_AddButtonOnBar(v, name) - end - end, - values = function() - local Locationlist = {} - local v - for idx,v in pairs (TitanBarData) do - if TitanBarDataVars[idx].show then --- if TitanPanelGetVar(TitanBarData[idx].name.."_Show") then - Locationlist[TitanBarData[idx].name] = TitanBarData[idx].locale_name - end - end - return Locationlist - end, - } - else - args[plug_in.id].args.top_bottom = { - order = 54, - type = "description", - name = TitanUtils_GetGoldText(L["TITAN_PANEL_MENU_BAR_ALWAYS"].." "..TitanGetVar(plug_in.id, "ForceBar")), - cmdHidden = true, - } - end - args[plug_in.id].args.space_50_2 = { - order = 59, - type = "description", - name = " ", - cmdHidden = true, - } - -- Notes, if available - args[plug_in.id].args.custom_notes = { - order = 60, - type = "header", - name = L["TITAN_PANEL_MENU_ADV_NOTES_PLUGIN"], - } - if plug_in.notes then - args[plug_in.id].args.notes = { - type = "description", - name = L["TITAN_PANEL_MENU_ADV_NOTES"], - order = 61, - name = "" - .._G["GREEN_FONT_COLOR_CODE"]..plug_in.notes.."|r", - cmdHidden = true, - } - else - args[plug_in.id].args.notes = { - type = "description", - name = L["TITAN_PANEL_MENU_ADV_NOTES"], - order = 61, - name = _G["GREEN_FONT_COLOR_CODE"]..L["TITAN_NONE"].."|r", - cmdHidden = true, - } - end - -- - -- Custom Labels 1 - 4 - local num_labels = tonumber(TitanGetVar(plug_in.id, "NumLabelsSeen") or 1) + }, + notes_delete = { + order = 999, + type = "description", + name = "\n\n"..L["TITAN_SKINS_REMOVE_NOTES"].."\n", + cmdHidden = true + }, + } +} +------------- - if num_labels >= 1 then - args[plug_in.id].args.custom_labels = { - order = 70, - type = "header", - name = L["TITAN_PANEL_MENU_ADV_LABEL"], - } - args[plug_in.id].args.custom_label_show = { - type = "toggle", - name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 1", - order = 71, - get = function(info) return (TitanGetVar(info[1], "CustomLabelTextShow") or false) end, - set = function(info, v) - TitanToggleVar(info[1], "CustomLabelTextShow"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - args[plug_in.id].args.custom_label_text = { - order = 72, - name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], - desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], - type = "input", width = "full", - get = function(info) return (TitanGetVar(info[1], "CustomLabelText") or "") end, - set = function(info,v) - TitanSetVar(info[1], "CustomLabelText", v); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - if num_labels >= 2 then - args[plug_in.id].args.custom_label2_show = { - type = "toggle", - name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 2", - order = 73, - get = function(info) return (TitanGetVar(info[1], "CustomLabel2TextShow") or false) end, - set = function(info, v) - TitanToggleVar(info[1], "CustomLabel2TextShow"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - args[plug_in.id].args.custom_label2_text = { - order = 74, - name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], - desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], - type = "input", width = "full", - get = function(info) return (TitanGetVar(info[1], "CustomLabel2Text") or "") end, - set = function(info,v) - TitanSetVar(info[1], "CustomLabel2Text", v); - TitanPanelButton_UpdateButton(info[1]) - end, - } - end - if num_labels >= 3 then - args[plug_in.id].args.custom_label3_show = { - type = "toggle", - name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 3", - order = 75, - get = function(info) return (TitanGetVar(info[1], "CustomLabel3TextShow") or false) end, - set = function(info, v) - TitanToggleVar(info[1], "CustomLabel3TextShow"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - args[plug_in.id].args.custom_label3_text = { - order = 76, - name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], - desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], - type = "input", width = "full", - get = function(info) return (TitanGetVar(info[1], "CustomLabel3Text") or "") end, - set = function(info,v) - TitanSetVar(info[1], "CustomLabel3Text", v); - TitanPanelButton_UpdateButton(info[1]) +--============= Extras + +--[[ local +NAME: optionsExtras +DESC: This is the table shell. The plugin info will be added by another routine. +--]] +local optionsExtras = { + name = TITAN_PANEL_CONFIG.topic.extras, --L["TITAN_PANEL_EXTRAS"], + type = "group", + args = {} +} + +--[[ local +NAME: TitanUpdateAddonAttempts +DESC: Show plugins that are not registered (loaded) but have config data. The data can be deleted by the user. +VAR: None +OUT: None +NOTE: +- As users change the plugins they use the old ones still have saved variable data stored by Titan. +- The old plugin data can be removed by the user when they will not longer use that plugin. +- This routine is called to 'redraw' the list as a user deletes data. +- A message is sent to chat that the plugin data has been deleted. +:NOTE +--]] +local function TitanUpdateExtras() + local args = optionsExtras.args + local plug_in = nil + + wipe(args) + + args["desc"] = { + order = 1, + type = "description", + name = L["TITAN_PANEL_EXTRAS_DESC"].."\n", + cmdHidden = true + } + for idx, value in pairs(TitanPluginExtras) do + if TitanPluginExtras[idx] then + local num = TitanPluginExtras[idx].num + local name = TitanPluginExtras[idx].id + args[name] = { + type = "group", + name = TitanUtils_GetGoldText(tostring(num)..": "..(name or "?")), + order = idx, + args = { + name = { + type = "description", + name = TitanUtils_GetGoldText(name or "?"), + cmdHidden = true, + order = 10, + }, + optionreset = { + name = L["TITAN_PANEL_EXTRAS_DELETE_BUTTON"], + order = 15, type = "execute", width = "full", + func = function(info, v) + TitanPluginSettings[info[1]] = nil -- delete the config entry + TitanPrint( + " '"..info[1].."' "..L["TITAN_PANEL_EXTRAS_DELETE_MSG"] + , "info") + TitanVariables_ExtraPluginSettings() -- rebuild the list + TitanUpdateExtras() -- rebuild the options config + AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") -- tell Ace to redraw end, + }, } + } + end + end + + AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") +end +------------- + +--============= Attempts + +--[[ local +NAME: optionsAddonAttempts +DESC: This is the table shell. The plugin info will be added by another routine. +--]] +local optionsAddonAttempts = { + name = TITAN_PANEL_CONFIG.topic.attempts, --L["TITAN_PANEL_ATTEMPTS"], + type = "group", + args = {} +} + +--[[ local +NAME: TitanUpdateAddonAttempts +DESC: Show the each plugin that attempted to register with Titan. This can be used by plugin developers as the create / update plugins (Titan or LDB). It can also be used by user to attempt to figure out why a plugin is not shown or to report an issue to Titan. +VAR: None +OUT: None +NOTE: +- This is called after the plugins are registered in the 'player entering world' event. It can be called again as plugins registered. +- Any plugins that attempted to register (no child frames though) are shown. See the Titan Utils section for more details on plugin registration. +- This option page is for display only. The user can take not action. +:NOTE +--]] +local function TitanUpdateAddonAttempts() + local args = optionsAddonAttempts.args + local plug_in = nil + + wipe(args) + + args["desc"] = { + order = 0, + type = "description", + name = L["TITAN_PANEL_ATTEMPTS_DESC"], + cmdHidden = true + } + for idx, value in pairs(TitanPluginToBeRegistered) do + if TitanPluginToBeRegistered[idx] + then + local num = tostring(idx) + local button = TitanPluginToBeRegistered[idx].button + local name = (TitanPluginToBeRegistered[idx].name or "?") + local reason = TitanPluginToBeRegistered[idx].status + local issue = TitanPluginToBeRegistered[idx].issue + local notes = TitanPluginToBeRegistered[idx].notes or "" + local category = TitanPluginToBeRegistered[idx].category + local ptype = TitanPluginToBeRegistered[idx].plugin_type + local btype = TitanPanelButton_GetType(idx) + local title = TitanPluginToBeRegistered[idx].name + local isChild = TitanPluginToBeRegistered[idx].isChild and true or false + if reason ~= TITAN_REGISTERED then + title = TitanUtils_GetRedText(title) + issue = TitanUtils_GetRedText(issue) end - if num_labels >= 4 then - args[plug_in.id].args.custom_label4_show = { - type = "toggle", - name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 4", - order = 77, - get = function(info) return (TitanGetVar(info[1], "CustomLabel4TextShow") or false) end, - set = function(info, v) - TitanToggleVar(info[1], "CustomLabel4TextShow"); - TitanPanelButton_UpdateButton(info[1]) - end, - } - args[plug_in.id].args.custom_label4_text = { - order = 78, - name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], - desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], - type = "input", width = "full", - get = function(info) return (TitanGetVar(info[1], "CustomLabel4Text") or "") end, - set = function(info,v) - TitanSetVar(info[1], "CustomLabel4Text", v); - TitanPanelButton_UpdateButton(info[1]) - end, + + if isChild then + -- Do not show. A child is part of (within) another plugin + -- showing it here would be confusing to the 'normal' user. + -- A plugin in author would know to look at the + -- TitanPluginToBeRegistered array directly. + else + args[num] = { + type = "group", + name = title, + order = idx, + args = { + name ={ + type = "description", + name = TitanUtils_GetGoldText("")..name, + cmdHidden = true, + order = 1, + }, + reason = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_STATUS"]..": ")..reason, + cmdHidden = true, + order = 2, + }, + issue = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_ISSUE"]..": \n")..issue, + cmdHidden = true, + order = 3, + }, + notes = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_NOTES"]..": \n")..notes, + cmdHidden = true, + order = 4, + }, + sp_1 = { + type = "description", + name = "", + cmdHidden = true, + order = 5, + }, + category = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_CATEGORY"]..": ")..category, + cmdHidden = true, + order = 10, + }, + ptype = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TYPE"]..": ")..ptype, --.." "..btype, + cmdHidden = true, + order = 11, + }, + button = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_BUTTON"]..": ")..button, + cmdHidden = true, + order = 12, + }, + num_val = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TABLE"]..": ")..num, + cmdHidden = true, + order = 13, + }, + } } end end end -- Config Tables changed! - AceConfigRegistry:NotifyChange("Titan Panel Addon Control") + AceConfigRegistry:NotifyChange(L["TITAN_PANEL"]) end - ------------- + +--============= Advanced + --[[ local NAME: optionsAdvanced DESC: Set the table to allow the user to control advanced features. @@ -2348,6 +2377,10 @@ local optionsAdvanced = { }, }, } +------------- + + +--============= Change History --[[ local NAME: Recent change history @@ -2374,6 +2407,9 @@ local changeHistory = { }, } + +--============= / Command + --[[ local NAME: slash command help DESC: Show detailed help for slash commands @@ -2434,7 +2470,125 @@ local slashHelp = { }, }, } +------------- + +--============= / Help + +local help_text = "" +do -- set help_text +help_text = "" + ..TitanUtils_GetGreenText("Short Bars: \n") + ..TitanUtils_GetHighlightText("" + .."Short bars are 10 shorter Titan bars that the user can place and change width.\n" + .."- Short bars are independent. They may be used with or without the full width Titan bars.\n" + ) + ..TitanUtils_GetGoldText("Enable :\n") + ..TitanUtils_GetHighlightText("" + .."- Open Configuration > Bars to enable and change Bar options.\n" + .."- The default position is the top center under the full width bars. They will be stacked to not overlap.\n" + ) + ..TitanUtils_GetGoldText("Change Size :\n") + ..TitanUtils_GetHighlightText("" + .."- Change width by 1 : Use Shift + mouse wheel.\n" + .."- Change width by 10: Use Shift + Ctrl + mouse wheel.\n" + ) + ..TitanUtils_GetGoldText("Move :\n") + ..TitanUtils_GetHighlightText("" + .."- Use Shift + left mouse on Bar, not plugins, and drag.\n" + .."- When dragging, best to place your mouse over the left side padding before moving or changing width.\n" + .."- When dragging stops, if the Short Bar is beyond the screen edge the Short Bar should 'snap' to the edge.\n" + ) + ..TitanUtils_GetGoldText("Skin :\n") + ..TitanUtils_GetHighlightText("" + .."- Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n" + ) + ..TitanUtils_GetGoldText("Reset :\n") + ..TitanUtils_GetHighlightText("" + .." In case a Short bar gets messed up, use Reset Position to place it at original position and width. This does not move plugins.\n" + ) + ..TitanUtils_GetGoldText("Limitations :\n") + ..TitanUtils_GetHighlightText("" + .."- Min width : Left side padding plus one icon width.\n" + .."- Max width : Screen width.\n" + .."- There is no 'snap together' or grid for placing Short Bars.\n" + .."\n" + ) + ..TitanUtils_GetGoldText("DOWNGRADING :\n") + ..TitanUtils_GetHighlightText("" + .."- From Titan 7.xx to 6.xx - Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin. Titan 6.xx will throw an error if ANY plugin is assigned to ANY Short Bar. If Titan throws an error after a downgrade, wipe the Titan saved variables.\n" + ) + .."\n\n" + ..TitanUtils_GetGreenText("All Bars: \n") + ..TitanUtils_GetHighlightText("" + .."- Bar Right click menu shows the name of the Bar in the menu title corresponding to configuration options.\n" + .."- Hide any Titan bar by using the Bar Right click menu then click Hide.\n" + .."- Titan does not restrict plugins to fit within the visible width. Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n" + .."- Setting a plugin to right-side will use the visible right side; and may overlap with left or center aligned plugins.\n" + ) + ..TitanUtils_GetGoldText("Skins :\n") + ..TitanUtils_GetHighlightText("" + .."- Select per Titan bar.\n" + .."- Select a skin for all Titan bars. This does NOT change the individual Titan bar skin settings.\n" + ) + ..TitanUtils_GetGoldText("Hide in Combat :\n") + ..TitanUtils_GetHighlightText("" + .."- Select per Titan bar.\n" + .."- Hide all Titan bars during combat. This does NOT change the individual Titan bar hide in combat settings.\n" + ) + ..TitanUtils_GetGoldText("Bar Order (English) :") + ..TitanUtils_GetHighlightText("" + .." Configuration > Bars shows localized Bar names.\n" + .."- Top : Always top of screen\n" + .."- Top 2 : Always under Top Bar\n" + .."- Bottom 2 : Always above Bottom Bar\n" + .."- Bottom : Always bottom of screen\n" + .."- Short 01 - 10 : User placed\n" + ) + .."\n\n" + ..TitanUtils_GetGreenText("Plugins: \n") + ..TitanUtils_GetGoldText("Show / Hide Plugins :") + ..TitanUtils_GetHighlightText("" + .." Use one of the methods below:\n" + .."- Open the right-click Bar menu; find the plugin in a category then click to toggle Show on the plugin.\n" + .."- Open Titan Configuration > Plugins then select the plugin by name then toggle Show. Uuse the Bar dropdown to select the Bar the plugin should be on.\n" + ) + ..TitanUtils_GetGoldText("Moving Plugins :") + ..TitanUtils_GetHighlightText("" + .." Use one of the methods below:\n" + .."- Open the right-click Bar menu of the Bar you want the plugin on; find the plugin in a category then toggle Show. If plugin is already shown on another Bar then toggle again to have it appear in this Bar.\n" + .."- Drag and drop on another bar or on the same bar.\n" + .."- Drag and drop on another plugin to swap the plugins.\n" + .."- Open Titan Configuration > Plugins then toggle Show. Use the Bar dropdown and Right / Left buttons to place the plugin as desired.\n" + ) + .."\n\n" +end +--[[ local +NAME: helpBars +DESC: Help for the Titan Panel user +:DESC +--]] +local helpBars = { + name = TITAN_PANEL_CONFIG.topic.help, + type = "group", + args = { + confgendesc = { + name = "Help", + order = 1, + type = "group", inline = true, + args = { + confdesc = { + order = 1, + type = "description", + name = help_text, + cmdHidden = true + }, + } + }, + } +} +------------- +------------- --[[ Titan NAME: TitanUpdateConfig DESC: This routine will handle the requests to update the various data items in Titan options screens. @@ -2453,6 +2607,7 @@ function TitanUpdateConfig(action) TitanUpdateChars() BuildSkins() BuildBars() + BuildAdj() end if action == "nuke" then local nuked = { @@ -2490,9 +2645,10 @@ Register the options tables with Ace then register the options with Blizz so the --[[ The first param needs to used for the 'add to options' The second param must be the table Ace will use to create the user options --]] -AceConfig:RegisterOptionsTable("Titan Panel Main", optionsControl) +AceConfig:RegisterOptionsTable("Titan Panel Main", titan_entry) AceConfig:RegisterOptionsTable("Titan Panel Bars", optionsBars) AceConfig:RegisterOptionsTable("Titan Panel Globals", optionsGlobals) +AceConfig:RegisterOptionsTable("Titan Panel Adjust", optionsAdjust) AceConfig:RegisterOptionsTable("Titan Panel Frames", optionsFrames) AceConfig:RegisterOptionsTable("Titan Panel Panel Control", optionsUIScale) AceConfig:RegisterOptionsTable("Titan Panel Skin Control", optionsSkins) @@ -2512,18 +2668,19 @@ The second param should be the same as the .name of the cooresponding table that if not, any 'open' may fail. --]] --AceConfigDialog:AddToBlizOptions("Titan Panel Main", L["TITAN_PANEL"]) -AceConfigDialog:AddToBlizOptions("Titan Panel Main", optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Bars", optionsBars.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Globals", optionsGlobals.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Control", optionsAddons.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Chars", optionsChars.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Frames", optionsFrames.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Panel Control", optionsUIScale.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Skin Control", optionsSkins.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Skin Custom", optionsSkinsCustom.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Extras", optionsExtras.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Attempts", optionsAddonAttempts.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Advanced", optionsAdvanced.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Changes", changeHistory.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Addon Slash", slashHelp.name, optionsControl.name) -AceConfigDialog:AddToBlizOptions("Titan Panel Help", helpBars.name, optionsControl.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Main", titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Bars", optionsBars.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Globals", optionsGlobals.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Adjust", optionsAdjust.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Control", optionsAddons.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Chars", optionsChars.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Frames", optionsFrames.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Panel Control", optionsUIScale.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Skin Control", optionsSkins.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Skin Custom", optionsSkinsCustom.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Extras", optionsExtras.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Attempts", optionsAddonAttempts.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Advanced", optionsAdvanced.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Changes", changeHistory.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Slash", slashHelp.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Help", helpBars.name, titan_entry.name) diff --git a/Titan/TitanConfig.lua.bak b/Titan/TitanConfig.lua.bak new file mode 100644 index 0000000..eb5793b --- /dev/null +++ b/Titan/TitanConfig.lua.bak @@ -0,0 +1,2657 @@ +--[[ File +NAME: TitanConfig.lua +DESC: This file contains routines used by Titan to show and process the Titan options. +Titan uses Ace libraries to place the Titan options within the Blizzard option screens. + +Most routines in this file are local because they create the Titan options. +These routines are called first when Titan processes the 'player entering world' event. +If an options list (skins, extra, etc) is changed by the user then the Ace table needs to be updated and WoW server informed to 'redraw'. +:DESC +--]] + +local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) +local AceConfigDialog = LibStub("AceConfigDialog-3.0") +local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") +local AceConfig = LibStub("AceConfig-3.0") + +local TitanSkinToRemove = "None"; +local TitanSkinName, TitanSkinPath = "", ""; +local TitanGlobalProfile = "" + +--[[ +Use for notes and change log in game. +New Release Format +Gold - version & date +Green - 'header' +Highlight - notes. tips. and details + +--]] +local notes = "" + ..TitanUtils_GetNormalText("" + .."- This is a major update which includes Short Bars; revamped Config screens; and other new features.\n" + .."\n" + .."- Titan Bag : Opening bags is still an option until taint issue is resolved.\n" + ) +local changes = "" +do -- recent change history +changes = changes + ..TitanUtils_GetGoldText("7.01.00.100007 : 2023/05/28\n") + ..TitanUtils_GetGreenText("Titan : \n") + ..TitanUtils_GetHighlightText("" + .."- Update TOC\n" + .."- Release Beta as mainline Titan. Includes all 7.x changes,\n" + .."- NEW : Config > Frame Adjust - Adjust one frame that holds widgets such as BG score, Telredor in Outlads, etc.\n" + ) + .."\n\n" + ..TitanUtils_GetGoldText("7.00.03.100007 : 2023/05/07\n") + ..TitanUtils_GetGreenText("Titan : \n") + ..TitanUtils_GetHighlightText("" + .."- Beta Release\n" + .."- Config > Scale and Font : Add order of strata to options text.\n" + .."- Repair : Add option to display repair in gold only.\n" + .."- Update for API changes in 10.1.\n" + .."- Fix for some LDB addons not loading (creation post Player Entering World).\n" + ) + .."\n\n" + ..TitanUtils_GetGoldText("7.00.02.100007 : 2023/03/31\n") + ..TitanUtils_GetGreenText("Titan : \n") + ..TitanUtils_GetHighlightText("" + .."- Beta on Discord\n" + .."- Update / fix for events appearing before Bars are initialized.\n" + ) + .."\n\n" + ..TitanUtils_GetGoldText("7.00.01.100007 : 2023/03/31\n") + ..TitanUtils_GetGreenText("Titan : \n") + ..TitanUtils_GetHighlightText("" + .."- NEW : 10 Short bars! See new consolidated Configuration > Titan Panel Help for enabling and using.\n" + .."- NEW : Skins OR solid color selectable in Config - Global or per bar. \n" + .."- NEW : Can Hide any Titan bar by right click on the Titan bar (not a plugin) then click Hide.\n" + .."- NEW : Hide in Combat is now selectable in Config - Global or per bar.\n" + .."- NOTE : Solid colors are done via the default color picker. Download an enhanced color picker for more options.\n" + .."- NOTE : Downgrading from Titan 7.xx to 6.xx - Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin.\n" + .."--- Titan 6.xx will throw an error IF any plugin is assigned to ANY Short Bar. If Titan throws an error, wipe the Titan saved variables.\n" + .."- Configuration > Bars has a new consolidated config for each Titan bar.\n" + .."- Configuration > Bars All has a new config for options across all Titan bars.\n" + .."- Configuration > Transparency moved into Bars.\n" + .."- Configuration > Titan Panel Help has details on using Titan bars.\n" + .."- Configuration > Skins shows available skins.\n" + .."- Remove adjustment of XP & status bars and Bag & Menu buttons.\n" + .."- Remove unused timers; only LDB timer left.\n" + .."- Internal code cleanup.\n" + .."- Update TOC\n" + ) + .."\n\n" +end + +TITAN_PANEL_CONFIG = { + topic = { + About = L["TITAN_PANEL"], + top = L["TITAN_PANEL_MENU_OPTIONS_BARS"], + globals = L["TITAN_PANEL_MENU_OPTIONS_BARS_ALL"], + bottom = L["TITAN_PANEL_MENU_BOTTOM_BARS"], + plugins = L["TITAN_PANEL_MENU_PLUGINS"], + profiles = L["TITAN_PANEL_MENU_PROFILES"], + tooltips = L["TITAN_PANEL_MENU_OPTIONS_SHORT"], + scale = L["TITAN_UISCALE_MENU_TEXT_SHORT"], + trans = L["TITAN_TRANS_MENU_TEXT_SHORT"], + skins = L["TITAN_PANEL_MENU_TEXTURE_SETTINGS"], + skinscust = L["TITAN_SKINS_OPTIONS_CUSTOM"], + extras = L["TITAN_PANEL_EXTRAS_SHORT"], + attempts = L["TITAN_PANEL_ATTEMPTS_SHORT"], + advanced = L["TITAN_PANEL_MENU_ADV"], + changes = L["TITAN_PANEL_MENU_CHANGE_HISTORY"], + slash = L["TITAN_PANEL_MENU_SLASH_COMMAND"], + help = L["TITAN_PANEL_MENU_HELP"], + adjust = "Frame Adjustment", --L["TITAN_PANEL_MENU_HELP"], + } + } + +-- Titan local helper funcs +local function TitanPanel_GetTitle() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "Title") or L["TITAN_NA"]; +end + +local function TitanPanel_GetAuthor() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "Author") or L["TITAN_NA"]; +end + +local function TitanPanel_GetCredits() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "X-Credits") or L["TITAN_NA"]; +end + +local function TitanPanel_GetCategory() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "X-Category") or L["TITAN_NA"]; +end + +local function TitanPanel_GetEmail() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "X-Email") or L["TITAN_NA"]; +end + +local function TitanPanel_GetWebsite() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "X-Website") or L["TITAN_NA"]; +end + +local function TitanPanel_GetLicense() + return TitanUtils_GetAddOnMetadata(TITAN_ID, "X-License") or L["TITAN_NA"]; +end + +-- helper functions + +--============= Titan Panel entry +-- +--[[ local +NAME: titan_entry +DESC: Local table to hold the 'about' Titan info in the options. +--]] +local titan_entry = { + name = TITAN_PANEL_CONFIG.topic.About, + desc = L["TITAN_PANEL"], + type = "group", + args = { + confgendesc = { + name = "Description", + order = 1, + type = "group", inline = true, + args = { + confdesc = { + order = 1, + type = "description", + name = "" + .."Titan Panel is an Interface Enhancement addon which allows you to add short display bars to the UI as well as the top and bottom of your game screen." + .."\n\n" + .."This addon does not interfere with, enhance, or replace any of your actual gameplay within the game. Titan Panel is meant to give you a quick visual point or click-on access to see the data related to your character without having to open other dialog boxes in the game or, in some cases, other addons." + .."\n\n" + .."Our main program allows you to add bars to the UI as well as the top and bottom of your game screen." + .."\n\n" + .."Over the years, we have been able to add some other features, but only if they do not interfere with your actual game experience.", + cmdHidden = true + }, + } + }, + confnotes = { + name = "Notes", + order = 3, + type = "group", inline = true, + args = { + confversiondesc = { + order = 1, + type = "description", + name = "" + ..notes, + cmdHidden = true + }, + } + }, + confthanks = { + name = "Thank You", + order = 5, + type = "group", inline = true, + args = { + confversiondesc = { + order = 1, + type = "description", + name = "" + .."We would like to thank all of the users of TitanPanel." + .."\n" + .."We understand you have many choices on which addons to enhance your World of Warcraft experience." + .." Our Mission has always been to provide you with a tool to help add and improve your experience without impeding your enjoyment of the game. ", + cmdHidden = true + }, + } + }, + confinfodesc = { + name = "About", + order = 7, + type = "group", inline = true, + args = { + confversiondesc = { + order = 1, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_VERSION"]..": " + .._G["GREEN_FONT_COLOR_CODE"]..TitanPanel_GetVersion(), + cmdHidden = true + }, + confauthordesc = { + order = 2, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_AUTHOR"]..": " + .."|cffff8c00"..TitanPanel_GetAuthor(), + cmdHidden = true + }, + confcreditsdesc = { + order = 3, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_CREDITS"]..": " + .._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetCredits(), + cmdHidden = true + }, + confcatdesc = { + order = 4, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_CATEGORY"]..": " + .._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetCategory(), + cmdHidden = true + }, + confemaildesc = { + order = 5, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_EMAIL"]..": " + .._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetEmail(), + cmdHidden = true + }, +--[[ has not been updated in quite a while... + confwebsitedesc = { + order = 6, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_WEB"]..": " + .._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetWebsite(), + cmdHidden = true + }, +--]] + conflicensedesc = { + order = 7, + type = "description", + name = "|cffffd700"..L["TITAN_ABOUT_LICENSE"]..": " + .._G["HIGHLIGHT_FONT_COLOR_CODE"]..TitanPanel_GetLicense(), + cmdHidden = true + }, + } + }, + } +} +------------- + +--============= Frame Adjust +-- +--[[ local +NAME: optionsAdjust +DESC: Bar control for the main (top) bars: +Each bar: +- Show +- Auto hide +- Center text (plugins) +Main (top) controls: +- Disable screen adjust - allows character frame and minimap to be 'over' the Titan bars +- Disable minimap adjust - allows the minimap to be 'over' the Titan bars +- Ticket frame adjust - adjusts the Blizz open ticket frame to be under the Titan bar(s) +:DESC +--]] +local optionsAdjust = { + name = TITAN_PANEL_CONFIG.topic.adjust, + type = "group", + args = { + } +} + +local function ColorAdjShown(frame_str) + local res = "" + if TitanAdjustSettings[frame_str].adjust then + res = frame_str -- leave as is + else + res = "|cff808080"..frame_str.._G["FONT_COLOR_CODE_CLOSE"] + end + + return res +end + +--[[ local +NAME: TitanUpdateAdj +DESC: Allow the user to control each Titan bar. +:DESC +VAR: None +OUT: None +--]] +local function TitanUpdateAdj(t, pos) + local args = t + local position = pos + + -- sort the bar data by their intended order + local bar_list = {} + local i = 0 + for idx, v in pairs (Titan_Panel.AdjList) do + i = i + 1 + bar_list[i] = v + end + table.sort(bar_list, function(a, b) + return a.frame_name < b.frame_name + end) + + wipe(args) + + for idx = 1, #bar_list do + -- ====== + -- Build the frame adjust list in order (left side) + -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1] + local f_name = bar_list[idx].frame_name + local v = TitanAdjustSettings[f_name] -- process this frame + position = position + 1 + args[f_name] = { + type = "group", + name = ColorAdjShown(f_name), + order = position, + } + -- ====== + -- adjust options (right side) + args[f_name].args = {} -- .args caused the nesting / right side + position = position + 1 -- Title divider + args[f_name].args.title = { + type = "header", + name = bar_list[idx].purpose, + order = position, width = "full", + } + position = position + 1 -- Show toggle + args[f_name].args.show = { + type = "toggle", width = .75, --"fill", + name = USE or "Use", --L["TITAN_PANEL_MENU_DISPLAY_BAR"], + order = position, + get = function(info) + local frame_str = info[1] + return TitanAdjustSettings[frame_str].adjust + end, + set = function(info, val) + local frame_str = info[1] + TitanAdjustSettings[frame_str].adjust = not TitanAdjustSettings[frame_str].adjust + TitanPanel_AdjustFrame(frame_str, "Adjust show changed : "..tostring(TitanAdjustSettings[frame_str].adjust)) + TitanUpdateAdj(optionsAdjust.args, 1000) + end, + } + -- ====== + position = position + 1 -- offset + args[f_name].args.offset = { + type = "range", width = "full", + name = "Vertical Adjustment", --L["TITAN_TRANS_MENU_TEXT_SHORT"], + order = position, + min = -200, max = 0, step = 1, + get = function(info) + local frame_str = info[1] + return TitanAdjustSettings[frame_str].offset + end, + set = function(info, a) + local frame_str = info[1] + TitanAdjustSettings[frame_str].offset = a +--[[ +print("Cfg Adj" +.." '"..tostring(frame_str).."'" +.." "..tostring(a).."" +) +--]] + TitanPanel_AdjustFrame(frame_str, "Adjust offset changed : "..tostring(a)) + end, + } + position = position + 1 -- spacer + args[f_name].args.colorspacer = { + order = position, type = "description", width = "full", + name = " ", + } + end + + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Bars") +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", a)).."" +) +--]===] +end + +local function BuildAdj() + TitanUpdateAdj(optionsAdjust.args, 1000) + AceConfigRegistry:NotifyChange("Titan Panel Adjust") +end +------------- + +--============= Bars +-- +--[[ local +NAME: optionsBars +DESC: Bar control for the main (top) bars: +Each bar: +- Show +- Auto hide +- Center text (plugins) +Main (top) controls: +- Disable screen adjust - allows character frame and minimap to be 'over' the Titan bars +- Disable minimap adjust - allows the minimap to be 'over' the Titan bars +- Ticket frame adjust - adjusts the Blizz open ticket frame to be under the Titan bar(s) +:DESC +--]] +local optionsBars = { + name = TITAN_PANEL_CONFIG.topic.top, + type = "group", + args = { + } +} + +local function ColorShown(bar) + local res = bar.locale_name + local frame_str = bar.frame_name + if TitanBarDataVars[frame_str].show then + -- leave as is + else + res = "|cff808080"..res.._G["FONT_COLOR_CODE_CLOSE"] + end + + return res +end + +--[[ local +NAME: TitanUpdateConfigBars +DESC: Allow the user to control each Titan bar. +:DESC +VAR: None +OUT: None +--]] +local function TitanUpdateConfigBars(t, pos) + local args = t + local position = pos + + -- sort the bar data by their intended order + local bar_list = {} + for _,v in pairs (TitanBarData) do + bar_list[v.order] = v + end + table.sort(bar_list, function(a, b) + return a.order < b.order + end) + + local label = "Bar" + + wipe(args) + + for idx = 1, #bar_list do + -- ====== + -- Build the bar list in order (left side) + -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1] + local v = bar_list[idx] -- process this bar + position = position + 1 + args[v.name] = { + type = "group", + name = ColorShown(v), + order = position, + } + -- ====== + -- Build bar options (right side) + args[v.name].args = {} -- ,args caused the nesting / right side + position = position + 1 -- Title divider + args[v.name].args.title = { + type = "header", + name = v.locale_name, + order = position, width = "full", + } + position = position + 1 -- Show toggle + args[v.name].args.show = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_DISPLAY_BAR"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].show + end, + set = function(info, val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].show = not TitanBarDataVars[frame_str].show + TitanPanelBarButton_DisplayBarsWanted(info[1].."Show "..tostring(val)) + TitanUpdateConfigBars(optionsBars.args, 1000) + end, + } + position = position + 1 -- Auto hide toggle + args[v.name].args.autohide = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_AUTOHIDE"], + order = position, + disabled = (v.hider == nil), + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].auto_hide + end, + set = function(info, val) + Titan_AutoHide_ToggleAutoHide(info[1]) -- short bar name + end, + } + position = position + 1 -- Center toggle + args[v.name].args.center = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_CENTER_TEXT"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER) + end, + set = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + if (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then + TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_LEFT + else + TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_CENTER + end + + -- Justify button position + TitanPanelButton_Justify(); + end, + } + position = position + 1 -- Combat hide toggle + args[v.name].args.hideincombat = { + type = "toggle", width = .75, --"fill", + name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].hide_in_combat + end, + set = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].hide_in_combat = + not TitanBarDataVars[frame_str].hide_in_combat + end, + } + position = position + 1 -- spacer + args[v.name].args.transpacer1 = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- spacer + args[v.name].args.resetposspacer = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- reset pos + args[v.name].args.resetbar = { + type = "execute", width = "Full", + name = L["TITAN_PANEL_MENU_RESET_POSITION"], + order = position, + disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + func = function(info, arg1) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanVariables_SetBarPos(_G[frame_str], true) + TitanPanelBarButton_DisplayBarsWanted("Bar reset to default position - "..tostring(info[1])) + end, + } + -- ====== + -- Background group + position = position + 1 -- background + args[v.name].args.back = { + type = "header", + name = "=== "..BACKGROUND.." ===", + order = position, + } + position = position + 1 -- select background + args[v.name].args.settextousebar = { + name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], + desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], + order = position, type = "select", width = "full", + style = "radio", + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].texure end, + set = function(info, val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].texure = val + TitanPanel_SetBarTexture(frame_str) + end, + values = { + [Titan_Panel.SKIN] = L["TITAN_SKINS_TITLE"], + [Titan_Panel.COLOR] = COLOR, + }, + } + position = position + 1 -- Title divider + args[v.name].args.skintitle = { + type = "header", + name = L["TITAN_SKINS_TITLE"], + order = position, width = "full", + } + position = position + 1 -- Skin select + args[v.name].args.skinselect = { + type = "select", width = "normal", + name = "", --v.locale_name, + order = position, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].skin.path + end, + set = function(info,val) + local frame_str = TitanVariables_GetFrameName(info[1]) + TitanBarDataVars[frame_str].skin.path = val + TitanPanel_SetBarTexture(frame_str) + if TitanSkinToRemove == TitanPanelGetVar("Texture"..info[1]) then + TitanSkinToRemove = "None" + end + end, + values = function(info) + local Skinlist = {} + local frame_str = TitanVariables_GetFrameName(info[1]) + for _, val in pairs (TitanSkins) do + if val.path ~= TitanBarDataVars[frame_str].skin.path then + -- if val.path ~= TitanPanelGetVar("Texture"..v.name) then + Skinlist[val.path] = "|cff19ff19"..val.name.."|r" + else + Skinlist[val.path] = "|cffffff9a"..val.name.."|r" + end + end + table.sort(Skinlist, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) + return Skinlist + end, + } + position = position + 1 -- spacer + args[v.name].args.skinspacer = { + order = position, type = "description", width = "5", + name = " ", + } + position = position + 1 -- selected skin + args[v.name].args.skinselected = { + name = "", + image = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + local vert = TitanBarData[frame_str].vert + if vert == TITAN_SHORT then + vert = TITAN_TOP + else + -- Use it as is + end + return TitanBarDataVars[frame_str].skin.path.."TitanPanelBackground"..vert.."0" + end, + imageWidth = 256, + order = position, type = "description", width = .5, --"60", + } + position = position + 1 -- transparency + args[v.name].args.trans = { + type = "range", width = "full", + name = L["TITAN_TRANS_MENU_TEXT_SHORT"], + order = position, + min = 0, max = 1, step = 0.01, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + return TitanBarDataVars[frame_str].skin.alpha + end, + set = function(info, a) + local frame_str = TitanVariables_GetFrameName(info[1]) + _G[frame_str]:SetAlpha(a) + TitanBarDataVars[frame_str].skin.alpha = a + end, + } + position = position + 1 -- Title divider + args[v.name].args.colortitle = { + type = "header", + name = COLOR, + order = position, width = "full", + } + position = position + 1 -- spacer + args[v.name].args.colorspacer = { + order = position, type = "description", width = "full", + name = " ", + } + position = position + 1 -- reset pos + args[v.name].args.colorselect = { + type = "color", width = "Full", + name = "Select Bar Color", -- L["TITAN_PANEL_MENU_RESET_POSITION"], + order = position, + -- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + hasAlpha = true, + get = function(info) + local frame_str = TitanVariables_GetFrameName(info[1]) + local color = TitanBarDataVars[frame_str].color + return color.r, + color.g, + color.b, + color.alpha + end, + set = function(info, r, g, b, a) + local frame_str = TitanVariables_GetFrameName(info[1]) + + TitanBarDataVars[frame_str].color.r = r + TitanBarDataVars[frame_str].color.g = g + TitanBarDataVars[frame_str].color.b = b + TitanBarDataVars[frame_str].color.alpha = a + TitanPanel_SetBarTexture(frame_str) + end, + } + end + + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Bars") +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", a)).."" +) +--]===] +end + +local function BuildBars() + TitanUpdateConfigBars(optionsBars.args, 1000) + AceConfigRegistry:NotifyChange("Titan Panel Bars") +end +------------- + +--============= Bars - All + +local optionsGlobals = { + name = TITAN_PANEL_CONFIG.topic.globals, + type = "group", + args = { + confdesc = { + order = 10, width = "full", + type = "header", + name = L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + setskinuseglobal = { + name = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN"], + desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"], + order = 15, type = "select", width = "full", + style = "radio", + get = function() return TitanBarDataVars["Global"].texure end, + set = function(_, v) + TitanBarDataVars["Global"].texure = v + for idx, val in pairs (TitanBarData) do + TitanPanel_SetBarTexture(idx) + end + end, + values = { + [Titan_Panel.SKIN] = L["TITAN_SKINS_TITLE"], + [Titan_Panel.COLOR] = COLOR, + [Titan_Panel.NONE] = NONE, + }, + }, + confskindesc = { + order = 20, width = "full", + type = "description", + name = L["TITAN_SKINS_TITLE"], + }, + setskinglobal = { + order = 21, type = "select", width = "30", + name = " ", --L["TITAN_SKINS_LIST_TITLE"], + desc = L["TITAN_SKINS_SET_DESC"], + get = function() return TitanBarDataVars["Global"].skin.path end, + set = function(_,v) + TitanBarDataVars["Global"].skin.path = v --TitanPanelSetVar("TexturePath", v); + if TitanBarDataVars["Global"].texure == Titan_Panel.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] = "|cff19ff19"..v.name.."|r" + else + Skinlist[v.path] = "|cffffff9a"..v.name.."|r" + 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 = 30, width = "10", + }, + show_skin_global_top = { + type = "description", + name = "", + image = function() + return TitanBarDataVars["Global"].skin.path.."TitanPanelBackgroundTop0" +-- return TitanPanelGetVar("TexturePath").."TitanPanelBackgroundTop0" + end, + imageWidth = 256, + order = 31, width = "60", + }, + confcolorspacer = { -- spacer + order = 50, type = "description", width = "full", + name = " ", + }, + confcolordesc = { + order = 51, 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 = 55, +-- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM), + hasAlpha = true, + get = function() + local color = TitanBarDataVars["Global"].color + return color.r, + color.g, + color.b, + color.alpha + end, + set = function(info, r, g, b, a) +--[===[ +print("Color new:" +.." "..tostring(format("%0.1f", r)).."" +.." "..tostring(format("%0.1f", g)).."" +.." "..tostring(format("%0.1f", b)).."" +.." "..tostring(format("%0.1f", 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_Panel.COLOR then + for idx, val in pairs (TitanBarData) do + TitanPanel_SetBarTexture(idx) + end + end + end, + }, + hidecombatspacer = { -- spacer + order = 100, type = "description", width = "full", + name = " ", + }, + confcombatdesc = { + order = 101, width = "full", + type = "header", + name = L["TITAN_PANEL_MENU_COMMAND"], + }, + setcombatuseglobal = { + name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"], + desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"], + order = 105, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideBarsInCombat") end, + set = function() TitanPanelToggleVar("HideBarsInCombat"); end, + }, + arenaspacer = { -- spacer + order = 200, type = "description", width = "full", + name = " ", + }, + confarenadesc = { + order = 201, width = "full", + type = "header", + name = BATTLEGROUND.." / "..ARENA, + }, + 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 = 205, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideBarsInPVP") end, + set = function() + TitanPanelToggleVar("HideBarsInPVP") + TitanPanelBarButton_DisplayBarsWanted("HideBarsInPVP" + .." "..tostring(TitanPanelGetVar("HideBarsInPVP"))) + end, + }, + } +} +------------- + +--============= Plugins + +--[[ local +NAME: optionsAddons +DESC: This is the table shell. The plugin controls will be added by another routine. +--]] +local optionsAddons = { + name = TITAN_PANEL_CONFIG.topic.plugins, --"Titan "..L["TITAN_PANEL_MENU_PLUGINS"], + type = "group", + args = {} +} + +local function ColorVisible(id, name) + local res = "?" + if TitanPanel_IsPluginShown(id) then + res = (name or "") + else + res = "|cff808080"..name.._G["FONT_COLOR_CODE_CLOSE"] + end + + return res +end + +--[[ local +NAME: TitanUpdateConfigAddons +DESC: Allow the user to control each plugin registered to Titan. +Controls honored from the plugin .registry: +- Show +- Show label text +- Right side +- Show icon +- Show text +Position: +- Shift left one plugin position on the bar +- Shift right one plugin position on the bar +- The shift is on the same bar +- The shift will not move a plugin from one side to the other +Bar: +- Drop down so the user can pick the bar the plugin is to be shown on. +- The list contains only the bars the user has selected to be shown. +- The user can not move a plugin to a hidden bar to 'hide' it. The user should ensure "Show Plugin" is unchecked. +:DESC +VAR: None +OUT: None +--]] +local function TitanUpdateConfigAddons() + local args = optionsAddons.args + local plug_in = nil + local plug_version = "" + + wipe(args) + + for idx, value in pairs(TitanPluginsIndex) do + plug_in = TitanUtils_GetPlugin(TitanPluginsIndex[idx]) + if plug_in then + if plug_in.version then + plug_version = TitanUtils_GetGreenText(" ("..plug_in.version..")") + else + plug_version = "" + end + args[plug_in.id] = { + type = "group", + name = ColorVisible(plug_in.id, plug_in.menuText or ""), + order = idx, + args = { + name = { + type = "header", + name = ((plug_in.menuText or "")..plug_version), + order = 1, + }, + show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW"], + order = 3, + get = function(info) return (TitanPanel_IsPluginShown(info[1])) end, + set = function(info, v) + local name = info[1] + if v then -- Show / add + local bar = (TitanGetVar(name, "ForceBar") or TitanUtils_PickBar()) + TitanUtils_AddButtonOnBar(bar, name) + else -- Hide / remove + TitanPanel_RemoveButton(name) + end + TitanUpdateConfigAddons() + end, + }, + } + } + + --ShowIcon + if plug_in.controlVariables and plug_in.controlVariables.ShowIcon then + args[plug_in.id].args.icon = + { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_ICON"], + order = 4, + get = function(info) return (TitanGetVar(info[1], "ShowIcon")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowIcon"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + --ShowLabel + if plug_in.controlVariables and plug_in.controlVariables.ShowLabelText then + args[plug_in.id].args.label = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_LABEL_TEXT"], + order = 5, + get = function(info) return (TitanGetVar(info[1], "ShowLabelText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowLabelText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + --ShowRegularText (LDB data sources only atm) + if plug_in.controlVariables and plug_in.controlVariables.ShowRegularText then + args[plug_in.id].args.regular_text = + { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_PLUGIN_TEXT"], + order = 6, + get = function(info) return (TitanGetVar(info[1], "ShowRegularText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowRegularText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + --ShowColoredText + if plug_in.controlVariables and plug_in.controlVariables.ShowColoredText then + args[plug_in.id].args.color_text = { + type = "toggle", + name = L["TITAN_PANEL_MENU_SHOW_COLORED_TEXT"], + order = 7, + get = function(info) return (TitanGetVar(info[1], "ShowColoredText")) end, + set = function(info, v) + TitanToggleVar(info[1], "ShowColoredText"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + + -- Right-side plugin + if plug_in.controlVariables and plug_in.controlVariables.DisplayOnRightSide then + args[plug_in.id].args.right_side = { + type = "toggle", + name = L["TITAN_PANEL_MENU_LDB_SIDE"], + order = 8, + get = function(info) return (TitanGetVar(info[1], "DisplayOnRightSide")) end, + set = function(info, v) + local bar = TitanUtils_GetWhichBar(info[1]) + TitanToggleVar(info[1], "DisplayOnRightSide"); + TitanPanel_RemoveButton(info[1]); + TitanUtils_AddButtonOnBar(bar, info[1]); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + -- Shift R / L + args[plug_in.id].args.plugin_position = { + order = 50, + type = "header", + name = L["TITAN_PANEL_MENU_POSITION"], + } + args[plug_in.id].args.shift_left = { + type = "execute", + name = "< "..L["TITAN_PANEL_SHIFT_LEFT"].." ", + order = 51, + func = function(info, arg1) + local name = info[1] + if TitanPanel_IsPluginShown(name) then + TitanUtils_ShiftButtonOnBarLeft(name) + end + end, + } + args[plug_in.id].args.shift_right = { + type = "execute", + name = "> "..L["TITAN_PANEL_SHIFT_RIGHT"], + order = 52, + func = function(info, arg1) + local name = info[1] + if TitanPanel_IsPluginShown(info[1]) then + TitanUtils_ShiftButtonOnBarRight(name) + end + end, + } + args[plug_in.id].args.space_50_1 = { + order = 53, + type = "header", + name = L["TITAN_PANEL_MENU_BAR"], + } + if not TitanVarExists(plug_in.id, "ForceBar") then + args[plug_in.id].args.top_bottom = { + order = 54, type = "select", + name = L["TITAN_PANEL_MENU_BAR"], + desc = L["TITAN_PANEL_MENU_DISPLAY_ON_BAR"], + get = function(info) + return TitanUtils_GetWhichBar(info[1]) end, + set = function(info,v) + local name = info[1] + if TitanPanel_IsPluginShown(name) then + TitanUtils_AddButtonOnBar(v, name) + end + end, + values = function() + local Locationlist = {} + local v + for idx,v in pairs (TitanBarData) do + if TitanBarDataVars[idx].show then +-- if TitanPanelGetVar(TitanBarData[idx].name.."_Show") then + Locationlist[TitanBarData[idx].name] = TitanBarData[idx].locale_name + end + end + return Locationlist + end, + } + else + args[plug_in.id].args.top_bottom = { + order = 54, + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_MENU_BAR_ALWAYS"].." "..TitanGetVar(plug_in.id, "ForceBar")), + cmdHidden = true, + } + end + args[plug_in.id].args.space_50_2 = { + order = 59, + type = "description", + name = " ", + cmdHidden = true, + } + -- Notes, if available + args[plug_in.id].args.custom_notes = { + order = 60, + type = "header", + name = L["TITAN_PANEL_MENU_ADV_NOTES_PLUGIN"], + } + if plug_in.notes then + args[plug_in.id].args.notes = { + type = "description", + name = L["TITAN_PANEL_MENU_ADV_NOTES"], + order = 61, + name = "" + .._G["GREEN_FONT_COLOR_CODE"]..plug_in.notes.."|r", + cmdHidden = true, + } + else + args[plug_in.id].args.notes = { + type = "description", + name = L["TITAN_PANEL_MENU_ADV_NOTES"], + order = 61, + name = _G["GREEN_FONT_COLOR_CODE"]..L["TITAN_NONE"].."|r", + cmdHidden = true, + } + end + -- + -- Custom Labels 1 - 4 + local num_labels = tonumber(TitanGetVar(plug_in.id, "NumLabelsSeen") or 1) + + if num_labels >= 1 then + args[plug_in.id].args.custom_labels = { + order = 70, + type = "header", + name = L["TITAN_PANEL_MENU_ADV_LABEL"], + } + args[plug_in.id].args.custom_label_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 1", + order = 71, + get = function(info) return (TitanGetVar(info[1], "CustomLabelTextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabelTextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label_text = { + order = 72, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabelText") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabelText", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 2 then + args[plug_in.id].args.custom_label2_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 2", + order = 73, + get = function(info) return (TitanGetVar(info[1], "CustomLabel2TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel2TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label2_text = { + order = 74, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel2Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel2Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 3 then + args[plug_in.id].args.custom_label3_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 3", + order = 75, + get = function(info) return (TitanGetVar(info[1], "CustomLabel3TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel3TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label3_text = { + order = 76, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel3Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel3Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + if num_labels >= 4 then + args[plug_in.id].args.custom_label4_show = { + type = "toggle", + name = L["TITAN_PANEL_MENU_ADV_LABEL_SHOW"].." 4", + order = 77, + get = function(info) return (TitanGetVar(info[1], "CustomLabel4TextShow") or false) end, + set = function(info, v) + TitanToggleVar(info[1], "CustomLabel4TextShow"); + TitanPanelButton_UpdateButton(info[1]) + end, + } + args[plug_in.id].args.custom_label4_text = { + order = 78, + name = L["TITAN_PANEL_MENU_ADV_CUSTOM"], + desc = L["TITAN_PANEL_MENU_ADV_CUSTOM_DESC"], + type = "input", width = "full", + get = function(info) return (TitanGetVar(info[1], "CustomLabel4Text") or "") end, + set = function(info,v) + TitanSetVar(info[1], "CustomLabel4Text", v); + TitanPanelButton_UpdateButton(info[1]) + end, + } + end + end + end + + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Addon Control") +end +------------- + +--============= Profiles + +--[[ local +NAME: optionsChars +DESC: This is the table shell. The toon info will be added by another routine. +--]] +local optionsChars = { + name = TITAN_PANEL_CONFIG.topic.profiles, --"Titan "..L["TITAN_PANEL_MENU_PROFILES"], + type = "group", + args = {} +} + +--[[ local +NAME: TitanUpdateChars +DESC: Allow the user to delete toon data (just not the one they are logged into). +VAR: None +OUT: None +NOTE: +- Users can delete toons but the saved variable data is still stored by Titan. +- The old toon data can be removed by the user. +- This routine is called to 'redraw' the list as a user deletes toon data. +- A message is sent to chat that the plugin data has been deleted. +:NOTE +--]] +local function TitanUpdateChars() + local players = {}; + -- Rip through the players (with server name) to sort them + for index, id in pairs(TitanSettings.Players) do + table.insert(players, index); + end + + -- set up the options for the user + local args = optionsChars.args + local plug_in = nil + + wipe(args) + + args["desc"] = { + order = 1, + type = "description", + name = L["TITAN_PANEL_CHARS_DESC"].."\n", + cmdHidden = true, + } + args["custom_header"] = { + order = 10, + type = "header", + name = L["TITAN_PANEL_MENU_PROFILE_CUSTOM"].."\n", + cmdHidden = true, + } + args["custom_save"] = { + order = 11, + type = "execute", + name = L["TITAN_PANEL_MENU_SAVE_SETTINGS"].."\n", + func = function(info, v) + TitanPanel_SaveCustomProfile() + TitanUpdateChars() -- rebuild the toons + end, + } + args["sp_1"] = { + type = "description", + name = "", + cmdHidden = true, + order = 12, + } + args["global_header"] = { + order = 20, + type = "header", + name = L["TITAN_PANEL_GLOBAL"], + cmdHidden = true, + } + args["global_use"] = { + order = 21, type = "toggle", width = "full", + name = L["TITAN_PANEL_GLOBAL_USE"], + desc = L["TITAN_PANEL_GLOBAL_USE_DESC"], + get = function() return TitanAllGetVar("GlobalProfileUse") end, + set = function() + TitanUtils_SetGlobalProfile(not TitanAllGetVar("GlobalProfileUse"), nil) + TitanUpdateChars() -- rebuild the toons + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") + end, + } + args["global_name"] = { + order = 22, type = "description", width = "full", + name = L["TITAN_PANEL_GLOBAL_PROFILE"]..": "..TitanUtils_GetGoldText(TitanAllGetVar("GlobalProfileName") or "?"), + } + args["sp_20"] = { + type = "description", + name = "", + cmdHidden = true, + order = 23, + } + args["profile_header"] = { + order = 30, + type = "header", + name = L["TITAN_PANEL_MENU_PROFILES"].."\n", + cmdHidden = true + } + for idx, value in pairs(players) do + local name = (players[idx] or "?") + local s, e, ident, server, player + local fancy_name = "" + local disallow = false + disallow = -- looks weird but we need to force a true or Ace complains + ((name == TitanSettings.Player) + or ((name == TitanAllGetVar("GlobalProfileName")) + and (TitanAllGetVar("GlobalProfileUse"))) + ) and true or false + + if name then + -- color code the name + -- - gold for normal profiles + -- - green for custom profiles + player, server = TitanUtils_ParseName(name) + -- handle custom profiles here + if server == TITAN_CUSTOM_PROFILE_POSTFIX then + fancy_name = TitanUtils_GetGreenText((name or "?")) + else + fancy_name = TitanUtils_GetGoldText((name or "?")) + end + -- end color code + args[name] = { + type = "group", + name = fancy_name, + desc = "", + order = 40, + args = { + name = { + type = "header", + name = TitanUtils_GetGoldText(name or "?"), + cmdHidden = true, + order = 10, + }, + sp_1 = { + type = "description", + name = "", + cmdHidden = true, + order = 11, + }, + optionload = { + name = L["TITAN_PANEL_MENU_LOAD_SETTINGS"], + order = 20, type = "execute", width = "full", + func = function(info, v) + TitanVariables_UseSettings(info[1], TITAN_PROFILE_USE) + end, + -- does not make sense to load current character profile or global profile + disabled = disallow, + }, + sp_20 = { + type = "description", + name = "", + cmdHidden = true, + order = 21, + }, + optionreset = { + name = L["TITAN_PANEL_MENU_DELETE_SETTINGS"], + order = 30, type = "execute", width = "full", + func = function(info, v) + TitanSettings.Players[info[1]] = nil -- delete the config entry + TitanPrint( + L["TITAN_PANEL_MENU_PROFILE"] + ..info[1] + ..L["TITAN_PANEL_MENU_PROFILE_DELETED"] + , "info") + if name == TitanAllGetVar("GlobalProfileName") then + TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) + end + TitanUpdateChars() -- rebuild the toons + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") + end, + -- can not delete current character profile or global profile + disabled = disallow, + }, + sp_30 = { + type = "description", + name = "", + cmdHidden = true, + order = 31, + }, + sp_31 = { + type = "description", + name = "", + cmdHidden = true, + order = 32, + }, + global_header = { + order = 40, + type = "header", + name = "Global", --L["TITAN_PANEL_MENU_VERSION_SHOWN"], + cmdHidden = true, + }, + use_as_global = { + order = 41, type = "toggle", width = "full", + name = L["TITAN_PANEL_GLOBAL_USE_AS"], + get = function() return TitanPanelGetVar("GlobalProfileName") == name end, + set = function() + if TitanPanelGetVar("GlobalProfileName") == name then + -- Was unchecked so clear the saved var + TitanAllSetVar("GlobalProfileName", TITAN_PROFILE_NONE) + else + -- Was checked so set the saved var + TitanAllSetVar("GlobalProfileName", name) + end + if TitanAllGetVar("GlobalProfileUse") then + -- Use whatever toon the user picked, if not use current toon + if TitanAllGetVar("GlobalProfileName") == TITAN_PROFILE_NONE then + TitanAllSetVar("GlobalProfileName", TitanSettings.Player) + end + TitanVariables_UseSettings(TitanAllGetVar("GlobalProfileName"), TITAN_PROFILE_USE) + TitanPrint( + L["TITAN_PANEL_MENU_PROFILE"] + ..":"..(TitanAllGetVar("GlobalProfileName") or "?") + ..": "..L["TITAN_PANEL_GLOBAL_RESET_PART"].."..." + , "info") + else + -- + end + TitanUpdateChars() + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") + end, + -- can not uncheck current global profile + disabled = disallow, + }, + sp_40 = { + type = "description", + name = "", + cmdHidden = true, + order = 42, + }, + }, + } + end + end + + -- tell the options screen there is a new list + AceConfigRegistry:NotifyChange("Titan Panel Addon Chars") +end +------------- + +--============= Tooltips and Frames + +--[[ local +NAME: optionsFrames +DESC: Show the general Tian options that hte user can change: +Tooltips: +- Hide in combat +- Show (or not) +Frames (bars): +- Lock buttons (plugins) - do not allow plugins to be moved via drag & drop. Shift left / right is still allowwed. +- Show plugin versions - show the version in the tooltips +Actions: +- Force LDB laucnhers to right side - This will move all converted LDB plugins of type launcher to the right side of the Titan bar. +- Refresh plugins - This can be used when a plugin has not updated its text. It may allow a plugin to show if it is not visible but the user has selected show. +- Reset Titan to default - used when the user wants to reset Titan options to a fresh install state. No plugins are removed by this. +:DESC +--]] +local optionsFrames = { + name = TITAN_PANEL_CONFIG.topic.tooltips, --L["TITAN_PANEL_MENU_OPTIONS"], + type = "group", + args = { + confdesc2 = { + order = 200, + type = "header", + name = L["TITAN_PANEL_MENU_OPTIONS_TOOLTIPS"], + }, + optiontooltip = { + name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], +-- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN"], + order = 201, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("ToolTipsShown") end, + set = function() TitanPanelToggleVar("ToolTipsShown"); end, + }, + optiontooltipcombat = { + name = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], +-- desc = L["TITAN_PANEL_MENU_TOOLTIPS_SHOWN_IN_COMBAT"], + order = 210, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("HideTipsInCombat") end, + set = function() TitanPanelToggleVar("HideTipsInCombat"); end, + }, + conftooltipdesc = { + name = "Tooltip Modifier", + type = "group", inline = true, + order = 220, + args = { + confdesc = { + order = 110, + type = "description", + name = "", + cmdHidden = true, + }, + advname = { + name = L["TITAN_PANEL_MENU_TOOLTIP_MOD"], + desc = "", -- L[""], + order = 120, type = "toggle", width = "full", + get = function() return TitanAllGetVar("UseTooltipModifer") end, + set = function(_, a) + TitanAllSetVar("UseTooltipModifer", a); + end, + }, + tooltipmod = { + name = "", + type = "group", inline = true, + order = 140, + args = { + alt_key = { + name = L["TITAN_KEY_ALT"], + desc = L["TITAN_KEY_ALT_DESC"], + order = 110, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferAlt") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferAlt", a); + end, + }, + ctrl_key = { + name = L["TITAN_KEY_CTRL"], + desc = L["TITAN_KEY_CTRL_DESC"], + order = 120, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferCtrl") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferCtrl", a); + end, + }, + shift_key = { + name = L["TITAN_KEY_SHIFT"], + desc = L["TITAN_KEY_SHIFT_DESC"], + order = 130, type = "toggle", --width = "full", + get = function() return TitanAllGetVar("TooltipModiferShift") end, + set = function(_, a) + TitanAllSetVar("TooltipModiferShift", a); + end, + }, + }, + }, + }, + }, + confdesc = { + order = 300, + type = "header", + name = L["TITAN_PANEL_MENU_OPTIONS_FRAMES"], + }, + optionlock = { + name = L["TITAN_PANEL_MENU_LOCK_BUTTONS"], + order = 301, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("LockButtons") end, + set = function() TitanPanelToggleVar("LockButtons") end, + }, + optionversions = { + name = L["TITAN_PANEL_MENU_VERSION_SHOWN"], + order = 302, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("VersionShown") end, + set = function() TitanPanelToggleVar("VersionShown") end, + }, + autohidelock = { + name = L["TITAN_PANEL_MENU_AUTOHIDE_IN_COMBAT"], + order = 303, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("LockAutoHideInCombat") end, + set = function() TitanPanelToggleVar("LockAutoHideInCombat") end, + }, + space_400_1 = { + order = 400, + type = "description", + name = " ", + cmdHidden = true, + }, + optionlaunchers = { + name = L["TITAN_PANEL_MENU_LDB_FORCE_LAUNCHER"], + order = 401, type = "execute", width = "full", + func = function() TitanPanelBarButton_ForceLDBLaunchersRight() end, + }, + space_500_1 = { + order = 500, + type = "description", + name = " ", + cmdHidden = true, + }, + pluginreset = { + name = L["TITAN_PANEL_MENU_PLUGIN_RESET"], + desc = L["TITAN_PANEL_MENU_PLUGIN_RESET_DESC"], + order = 501, type = "execute", width = "full", + func = function() TitanPanel_InitPanelButtons() end, + }, + space_600_1 = { + order = 600, + type = "description", + name = " ", + cmdHidden = true, + }, + optionreset = { + name = L["TITAN_PANEL_MENU_RESET"].." " + .._G["GREEN_FONT_COLOR_CODE"] + ..L["TITAN_PANEL_MENU_RELOADUI"], + order = 601, type = "execute", width = "full", + func = function() TitanPanel_ResetToDefault() end, + } + } + } +------------- + +--============= Scale and Font + +--[[ local +NAME: optionsUIScale +DESC: Local table to hold the Titan options that allow a user to adjust: +- UI scale +- Titan scale for bars +- Spacing between Titan plugins (right side) +- Spacing between Titan icons (left side) +- Titan tooltip font scale (bar and plugins) +- Toggle the tooltip font scale (allow Titan or Blizz to control) +- Set Titan font (bar and plugins) +- Set Titan font size +- Set Titan bar strata (tells Blizz which frames could go over Titan bar (and plugins) +:DESC +--]] +local optionsUIScale = { + name = TITAN_PANEL_CONFIG.topic.scale, --L["TITAN_UISCALE_MENU_TEXT"], + type = "group", + args = { + confdesc = { + order = 1, + type = "description", + name = L["TITAN_UISCALE_MENU_DESC"].."\n", + cmdHidden = true + }, + uiscale = { + name = L["TITAN_UISCALE_CONTROL_TITLE_UI"], + desc = L["TITAN_UISCALE_SLIDER_DESC"], + order = 2, type = "range", width = "full", + min = 0.64, max = 1, step = 0.01, + get = function() return UIParent:GetScale() end, + set = function(_, a) + SetCVar("useUiScale", 1); + SetCVar("uiScale", a, "uiScale"); + end, + }, + panelscale = { + name = L["TITAN_UISCALE_CONTROL_TITLE_PANEL"], + desc = L["TITAN_UISCALE_PANEL_SLIDER_DESC"], + order = 3, type = "range", width = "full", + min = 0.75, max = 1.25, step = 0.01, + get = function() return TitanPanelGetVar("Scale") end, + set = function(_, a) + TitanPanelSetVar("Scale", a) +-- TitanPanel_SetScale() + TitanPanel_InitPanelBarButton("Config scale change "..a) + end, + disabled = function() + if InCombatLockdown() then + return true + else + return false + end + end, + }, + buttonspacing = { + name = L["TITAN_UISCALE_CONTROL_TITLE_BUTTON"], + desc = L["TITAN_UISCALE_BUTTON_SLIDER_DESC"], + order = 4, type = "range", width = "full", + min = 5, max = 80, step = 1, + get = function() return TitanPanelGetVar("ButtonSpacing") end, + set = function(_, a) + TitanPanelSetVar("ButtonSpacing", a); + TitanPanel_InitPanelButtons(); + end, + }, + iconspacing = { -- right side plugins + name = L["TITAN_UISCALE_CONTROL_TITLE_ICON"], + desc = L["TITAN_UISCALE_ICON_SLIDER_DESC"], + order = 5, type = "range", width = "full", + min = 0, max = 20, step = 1, + get = function() return TitanPanelGetVar("IconSpacing") end, + set = function(_, a) + TitanPanelSetVar("IconSpacing", a); + TitanPanel_InitPanelButtons(); + end, + }, + spacer01 = { + type = "description", + name = "\n\n", imageHeight = 0, + order = 10, width = "full", + }, + tooltipdesc = { + order = 20, width = "full", + type = "header", + name = "Tooltip", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + tooltipfont = { + name = L["TITAN_UISCALE_CONTROL_TOOLTIP_TOOLTIPFONT"], + desc = L["TITAN_UISCALE_TOOLTIP_SLIDER_DESC"], + order = 21, type = "range", width = "full", + min = 0.5, max = 1.3, step = 0.01, + get = function() return TitanPanelGetVar("TooltipFont") end, + set = function(_, a) + TitanPanelSetVar("TooltipFont", a); + end, + }, + tooltipfontdisable = { + name = L["TITAN_UISCALE_TOOLTIP_DISABLE_TEXT"], + desc = L["TITAN_UISCALE_DISABLE_TOOLTIP_DESC"], + order = 22, type = "toggle", width = "full", + get = function() return TitanPanelGetVar("DisableTooltipFont") end, + set = function() + TitanPanelToggleVar("DisableTooltipFont"); + end, + }, + fontdesc = { + order = 30, width = "full", + type = "header", + name = "Font", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + fontselection = { + name = L["TITAN_PANEL_MENU_LSM_FONTS"], + desc = L["TITAN_PANEL_MENU_LSM_FONTS_DESC"], + order = 31, type = "select", width = "40", + dialogControl = "LSM30_Font", + get = function() + return TitanPanelGetVar("FontName") + end, + set = function(_, v) + TitanPanelSetVar("FontName", v) + TitanSetPanelFont(v, TitanPanelGetVar("FontSize")) + end, + values = AceGUIWidgetLSMlists.font, + }, + fontspacer = { + order = 32, type = "description", width = "20", + name = " ", + }, + fontsize = { + name = L["TITAN_PANEL_MENU_FONT_SIZE"], + desc = L["TITAN_PANEL_MENU_FONT_SIZE_DESC"], + order = 33, type = "range", width = "40", + min = 7, max = 15, step = 1, + get = function() return TitanPanelGetVar("FontSize") end, + set = function(_, v) + TitanPanelSetVar("FontSize", v); + TitanSetPanelFont(TitanPanelGetVar("FontName"), v) + end, + }, + paneldesc = { + order = 40, width = "full", + type = "header", + name = "Strata", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TITLE"], + }, + panelstrata = { + name = L["TITAN_PANEL_MENU_FRAME_STRATA"], + desc = L["TITAN_PANEL_MENU_FRAME_STRATA_DESC"], + order = 41, type = "select", + get = function() + return TitanPanelGetVar("FrameStrata") + end, + set = function(_, v) + TitanPanelSetVar("FrameStrata", v) + TitanVariables_SetPanelStrata(v) + end, + values = { + ["BACKGROUND"] = "BACKGROUND", + ["LOW"] = "LOW", + ["MEDIUM"] = "MEDIUM", + ["HIGH"] = "HIGH", + ["DIALOG"] = "DIALOG", + ["FULLSCREEN"] = "FULLSCREEN", + }, + }, + panelstrataorder = { + order = 42, + type = "description", + name = "Order of Strata\n" + .."- BACKGROUND\n" + .."- LOW - default\n" + .."- MEDIUM\n" + .."- HIGH\n" + .."- DIALOG\n" + .."- FULLSCREEN\n", + cmdHidden = true + }, + } +} +------------- + +--============= Skins + +--[[ local +NAME: optionsSkins +DESC: Local table to hold the Titan skins options. Shows default Titan and any custom skins the user has added. +--]] +local optionsSkins = { + name = TITAN_PANEL_CONFIG.topic.skins, + type = "group", + args = { + } +} + +local function Show_Skins(t, position) +--[[ + table.sort(TitanSkins, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) +--]] + local skin = "Skin" + for idx, v in pairs (TitanSkins) do + + position = position + 1 -- spacer + t[skin..position] = { + type = "header", + name = "", + order = position, width = "full", + } + + position = position + 1 -- Name of skin (col 1) + t[skin..position] = { + type = "description", + name = "|cff19ff19"..v.name.."|r", + order = position, width = "30", + } + + position = position + 1 -- Top image (col 2) + t[skin..position] = { + type = "description", + name = "", + image = v.path.."TitanPanelBackgroundTop0", + imageWidth = 256, + order = position, width = "50", + } + + position = position + 1 -- spacer + t[skin..position] = { + type = "description", + name = "", imageHeight = 0, + order = position, width = "full", + } + + position = position + 1 -- Bottom (col 1) + t[skin..position] = { + type = "description", + name = "", + order = position, width = "30", + } + position = position + 1 -- Bottom image (col 2) + t[skin..position] = { + type = "description", + name = "", + image = v.path.."TitanPanelBackgroundBottom0", + imageWidth = 256, + order = position, width = "50", + } + + position = position + 1 -- final spacer - bottom of config + t[skin..position] = { + type = "description", + name = "", imageHeight = 0, + order = position, width = "full", + } + end + + position = position + 1 -- final spacer - bottom of config + t[skin..position] = { + type = "description", + name = "", + order = position, width = "full", + } +end + +local function BuildSkins() + optionsSkins.args = {} + + Show_Skins(optionsSkins.args, 100) -- the current list of skins with images + AceConfigRegistry:NotifyChange("Titan Panel Skin Control") +end + +--============= Skins - Custom + +--[[ local +NAME: TitanPanel_AddNewSkin +DESC: Add each skin to the options list. If the user had added custom skins these will be shown as well. +VAR: skinname - the file name to use +VAR: skinpath - the file path to use +OUT: None +NOTE: +- Blizz *does not allow* LUA to access the user file system dynamically so the skins have to be input by hand. Titan can not search for available skins in the Artwork folder. +- On the flip side a user can add a custom skin to the Titan saved variables then later delete the skin from the file system. This will not cause an error when the user tries to use (show) that skin but Titan will show a 'blank' skin. +:NOTE +--]] +local function TitanPanel_AddNewSkin(skinname, skinpath) + -- name and path must be provided + if not skinname or not skinpath then return end + + -- name cannot be empty or "None", path cannot be empty + if skinname == "" or skinname == L["TITAN_NONE"] or skinpath == "" then + return + end + + -- Assume the skin is already in the Titan saved variables list + local found + for _,i in pairs(TitanSkins) do + if i.name == skinname or i.path == skinpath then + found = true + break + end + end + + -- The skin is new so add it to the Titan saved variables list + if not found then + table.insert(TitanSkins, {name = skinname, path = skinpath }) + end + + BuildSkins() + +end + +--[[ local +NAME: optionsSkinsCustom +DESC: Local table to hold the Titan custom skins options that allow a user to add or delete skins. +- You may not remove the currently used skin +- or the default one +- or a Titan default skin (it would only come back...) +:DESC +--]] +local optionsSkinsCustom = { + name = TITAN_PANEL_CONFIG.topic.skinscust, --L["TITAN_SKINS_TITLE_CUSTOM"], + type = "group", + args = { + confdesc = { + order = 1, + type = "description", + name = L["TITAN_SKINS_MAIN_DESC"].."\n", + cmdHidden = true + }, + nulloption1 = { + order = 5, + type = "description", + name = " ", + cmdHidden = true + }, + addskinheader = { + order = 10, + type = "header", + name = L["TITAN_SKINS_NEW_HEADER"], + }, + newskinname = { + order = 11, + name = L["TITAN_SKINS_NAME_TITLE"], + desc = L["TITAN_SKINS_NAME_DESC"], + type = "input", width = "full", + get = function() return TitanSkinName end, + set = function(_,v) TitanSkinName = v end, + }, + newskinpath = { + order = 12, + name = L["TITAN_SKINS_PATH_TITLE"], + desc = L["TITAN_SKINS_PATH_DESC"], + type = "input", width = "full", + get = function() return TitanSkinPath end, + set = function(_,v) TitanSkinPath = TitanSkinsCustomPath..v..TitanSkinsPathEnd end, + + }, + addnewskin = { + order = 13, + name = L["TITAN_SKINS_ADD_HEADER"], type = "execute", + desc = L["TITAN_SKINS_ADD_DESC"], + func = function() + if TitanSkinName ~= "" and TitanSkinPath ~= "" then + TitanPanel_AddNewSkin(TitanSkinName, TitanSkinPath) + TitanSkinName = "" + TitanSkinPath = "" + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") + end + end, + }, + nulloption2 = { + order = 14, + type = "description", + name = " ", + cmdHidden = true + }, + removeskinheader = { + order = 20, + type = "header", + name = L["TITAN_SKINS_REMOVE_HEADER"], + }, + removeskinlist = { + order = 21, type = "select", width = "full", + name = L["TITAN_SKINS_REMOVE_HEADER"], + desc = L["TITAN_SKINS_REMOVE_DESC"], + get = function() return TitanSkinToRemove end, + set = function(_,v) + TitanSkinToRemove = v + end, + values = function() + local Skinlist = {} + local v; + for _,v in pairs (TitanSkins) do + if v.path ~= TitanPanelGetVar("TexturePath") + and v.path ~= "Interface\\AddOns\\Titan\\Artwork\\" + and v.titan ~= true + then + Skinlist[v.path] = "|cff19ff19"..v.name.."|r" + end + if v.path == TitanSkinToRemove then + Skinlist[v.path] = "|cffffff9a"..v.name.."|r" + end + end + if TitanSkinToRemove ~= "None" then + Skinlist["None"] = "|cff19ff19"..L["TITAN_NONE"].."|r" + else + Skinlist["None"] = "|cffffff9a"..L["TITAN_NONE"].."|r" + end + table.sort(Skinlist, function(a, b) + return string.lower(TitanSkins[a].name) + < string.lower(TitanSkins[b].name) + end) + return Skinlist + end, + }, + removeskin = { + order = 22, type = "execute", + name = L["TITAN_SKINS_REMOVE_BUTTON"], + desc = L["TITAN_SKINS_REMOVE_BUTTON_DESC"], + func = function() + if TitanSkinToRemove == "None" then return end + local k, v; + for k, v in pairs (TitanSkins) do + if v.path == TitanSkinToRemove then + table.remove(TitanSkins, k) + TitanSkinToRemove = "None" + -- Config Tables changed! + AceConfigRegistry:NotifyChange("Titan Panel Skin Custom") + break + end + end + end, + }, + nulloption4 = { + order = 24, + type = "description", + name = " ", + cmdHidden = true + }, + resetskinhdear = { + order = 200, + type = "header", + name = L["TITAN_SKINS_RESET_HEADER"], + }, + defaultskins = { + order = 201, + name = L["TITAN_SKINS_RESET_DEFAULTS_TITLE"], type = "execute", + desc = L["TITAN_SKINS_RESET_DEFAULTS_DESC"], + func = function() + TitanSkins = TitanSkinsDefault; + BuildSkins() + end, + }, + notes_delete = { + order = 999, + type = "description", + name = "\n\n"..L["TITAN_SKINS_REMOVE_NOTES"].."\n", + cmdHidden = true + }, + } +} +------------- + +--============= Extras + +--[[ local +NAME: optionsExtras +DESC: This is the table shell. The plugin info will be added by another routine. +--]] +local optionsExtras = { + name = TITAN_PANEL_CONFIG.topic.extras, --L["TITAN_PANEL_EXTRAS"], + type = "group", + args = {} +} + +--[[ local +NAME: TitanUpdateAddonAttempts +DESC: Show plugins that are not registered (loaded) but have config data. The data can be deleted by the user. +VAR: None +OUT: None +NOTE: +- As users change the plugins they use the old ones still have saved variable data stored by Titan. +- The old plugin data can be removed by the user when they will not longer use that plugin. +- This routine is called to 'redraw' the list as a user deletes data. +- A message is sent to chat that the plugin data has been deleted. +:NOTE +--]] +local function TitanUpdateExtras() + local args = optionsExtras.args + local plug_in = nil + + wipe(args) + + args["desc"] = { + order = 1, + type = "description", + name = L["TITAN_PANEL_EXTRAS_DESC"].."\n", + cmdHidden = true + } + for idx, value in pairs(TitanPluginExtras) do + if TitanPluginExtras[idx] then + local num = TitanPluginExtras[idx].num + local name = TitanPluginExtras[idx].id + args[name] = { + type = "group", + name = TitanUtils_GetGoldText(tostring(num)..": "..(name or "?")), + order = idx, + args = { + name = { + type = "description", + name = TitanUtils_GetGoldText(name or "?"), + cmdHidden = true, + order = 10, + }, + optionreset = { + name = L["TITAN_PANEL_EXTRAS_DELETE_BUTTON"], + order = 15, type = "execute", width = "full", + func = function(info, v) + TitanPluginSettings[info[1]] = nil -- delete the config entry + TitanPrint( + " '"..info[1].."' "..L["TITAN_PANEL_EXTRAS_DELETE_MSG"] + , "info") + TitanVariables_ExtraPluginSettings() -- rebuild the list + TitanUpdateExtras() -- rebuild the options config + AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") -- tell Ace to redraw + end, + }, + } + } + end + end + + AceConfigRegistry:NotifyChange("Titan Panel Addon Extras") +end +------------- + +--============= Attempts + +--[[ local +NAME: optionsAddonAttempts +DESC: This is the table shell. The plugin info will be added by another routine. +--]] +local optionsAddonAttempts = { + name = TITAN_PANEL_CONFIG.topic.attempts, --L["TITAN_PANEL_ATTEMPTS"], + type = "group", + args = {} +} + +--[[ local +NAME: TitanUpdateAddonAttempts +DESC: Show the each plugin that attempted to register with Titan. This can be used by plugin developers as the create / update plugins (Titan or LDB). It can also be used by user to attempt to figure out why a plugin is not shown or to report an issue to Titan. +VAR: None +OUT: None +NOTE: +- This is called after the plugins are registered in the 'player entering world' event. It can be called again as plugins registered. +- Any plugins that attempted to register (no child frames though) are shown. See the Titan Utils section for more details on plugin registration. +- This option page is for display only. The user can take not action. +:NOTE +--]] +local function TitanUpdateAddonAttempts() + local args = optionsAddonAttempts.args + local plug_in = nil + + wipe(args) + + args["desc"] = { + order = 0, + type = "description", + name = L["TITAN_PANEL_ATTEMPTS_DESC"], + cmdHidden = true + } + for idx, value in pairs(TitanPluginToBeRegistered) do + if TitanPluginToBeRegistered[idx] + then + local num = tostring(idx) + local button = TitanPluginToBeRegistered[idx].button + local name = (TitanPluginToBeRegistered[idx].name or "?") + local reason = TitanPluginToBeRegistered[idx].status + local issue = TitanPluginToBeRegistered[idx].issue + local notes = TitanPluginToBeRegistered[idx].notes or "" + local category = TitanPluginToBeRegistered[idx].category + local ptype = TitanPluginToBeRegistered[idx].plugin_type + local btype = TitanPanelButton_GetType(idx) + local title = TitanPluginToBeRegistered[idx].name + local isChild = TitanPluginToBeRegistered[idx].isChild and true or false + if reason ~= TITAN_REGISTERED then + title = TitanUtils_GetRedText(title) + issue = TitanUtils_GetRedText(issue) + end + + if isChild then + -- Do not show. A child is part of (within) another plugin + -- showing it here would be confusing to the 'normal' user. + -- A plugin in author would know to look at the + -- TitanPluginToBeRegistered array directly. + else + args[num] = { + type = "group", + name = title, + order = idx, + args = { + name ={ + type = "description", + name = TitanUtils_GetGoldText("")..name, + cmdHidden = true, + order = 1, + }, + reason = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_STATUS"]..": ")..reason, + cmdHidden = true, + order = 2, + }, + issue = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_ISSUE"]..": \n")..issue, + cmdHidden = true, + order = 3, + }, + notes = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_NOTES"]..": \n")..notes, + cmdHidden = true, + order = 4, + }, + sp_1 = { + type = "description", + name = "", + cmdHidden = true, + order = 5, + }, + category = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_CATEGORY"]..": ")..category, + cmdHidden = true, + order = 10, + }, + ptype = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TYPE"]..": ")..ptype, --.." "..btype, + cmdHidden = true, + order = 11, + }, + button = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_BUTTON"]..": ")..button, + cmdHidden = true, + order = 12, + }, + num_val = { + type = "description", + name = TitanUtils_GetGoldText(L["TITAN_PANEL_ATTEMPTS_TABLE"]..": ")..num, + cmdHidden = true, + order = 13, + }, + } + } + end + end + end + + -- Config Tables changed! + AceConfigRegistry:NotifyChange(L["TITAN_PANEL"]) +end +------------- + +--============= Advanced + +--[[ local +NAME: optionsAdvanced +DESC: Set the table to allow the user to control advanced features. +Controls: +- Entering world timer - some users need Titan to wait longer whenever the splash / loading screen is shown before adjusting frames and (re)setting data. +- Vehicle timer - some users need Titan to wait longer whenever entering or leaving a vehicle before adjusting frames. +:DESC +--]] +local optionsAdvanced = { + name = TITAN_PANEL_CONFIG.topic.advanced, --L["TITAN_PANEL_MENU_ADV"], + type = "group", + args = { + confoutputdesc = { + name = "Output", + type = "group", inline = true, + order = 3, + args = { + confdesc = { + order = 110, + type = "description", + name = L["TITAN_PANEL_MENU_ADV_DESC"], + cmdHidden = true + }, + advname = { + name = L["TITAN_PANEL_MENU_ADV_NAME"], + desc = L["TITAN_PANEL_MENU_ADV_NAME_DESC"], + order = 120, type = "toggle", width = "full", + get = function() return not TitanAllGetVar("Silenced") end, -- yes, we did it to ourselves... + set = function(_, a) + TitanAllSetVar("Silenced", not a); + end, + }, + advplugins = { + name = L["TITAN_PANEL_MENU_ADV_PLUGINS"], + desc = L["TITAN_PANEL_MENU_ADV_PLUGINS_DESC"], + order = 120, type = "toggle", width = "full", + get = function() return TitanAllGetVar("Registered") end, + set = function(_, a) + TitanAllSetVar("Registered", a); + end, + }, + }, + }, + }, +} +------------- + + +--============= Change History + +--[[ local +NAME: Recent change history +DESC: Show change history of releases +:DESC +--]] +local changeHistory = { + name = TITAN_PANEL_CONFIG.topic.changes, --L["TITAN_PANEL_MENU_ADV"], + type = "group", + args = { + confchanges = { + order = 7, + name = " ", --CHANGES_COLON, + type = "group", inline = true, + args = { + confversiondesc = { + order = 1, + type = "description", + name = ""..changes, + cmdHidden = true + }, + } + }, + }, +} + + +--============= / Command + +--[[ local +NAME: slash command help +DESC: Show detailed help for slash commands +:DESC +--]] +local slashHelp = { + name = TITAN_PANEL_CONFIG.topic.slash, + type = "group", + args = { + confslash = { + name = (HELP or "Help"), + order = 3, + type = "group", inline = true, + args = { + confversiondesc = { + order = 1, + type = "description", + name = "" + ..TitanUtils_GetGoldText("reset\n") + ..L["TITAN_PANEL_SLASH_RESET_0"].."\n" + ..L["TITAN_PANEL_SLASH_RESET_1"].."\n" + ..L["TITAN_PANEL_SLASH_RESET_2"].."\n" + ..L["TITAN_PANEL_SLASH_RESET_3"].."\n" + ..L["TITAN_PANEL_SLASH_RESET_4"].."\n" + ..L["TITAN_PANEL_SLASH_RESET_5"].."\n" + .."\n" + ..TitanUtils_GetGoldText("gui\n") + ..L["TITAN_PANEL_SLASH_GUI_0"].."\n" + ..L["TITAN_PANEL_SLASH_GUI_1"].."\n" + ..L["TITAN_PANEL_SLASH_GUI_2"].."\n" + ..L["TITAN_PANEL_SLASH_GUI_3"].."\n" + .."\n" + ..TitanUtils_GetGoldText("profile\n") + ..L["TITAN_PANEL_SLASH_PROFILE_0"].."\n" + ..L["TITAN_PANEL_SLASH_PROFILE_1"].."\n" + ..L["TITAN_PANEL_SLASH_PROFILE_2"].."\n" + ..L["TITAN_PANEL_SLASH_PROFILE_3"].."\n" + .."\n" + ..TitanUtils_GetGoldText("silent\n") + ..L["TITAN_PANEL_SLASH_SILENT_0"].."\n" + ..L["TITAN_PANEL_SLASH_SILENT_1"].."\n" + .."\n" + ..TitanUtils_GetGoldText("orderhall\n") + ..L["TITAN_PANEL_SLASH_ORDERHALL_0"].."\n" + ..L["TITAN_PANEL_SLASH_ORDERHALL_1"].."\n" + .."\n" + ..TitanUtils_GetGoldText("help\n") + ..L["TITAN_PANEL_SLASH_HELP_0"].."\n" + ..L["TITAN_PANEL_SLASH_HELP_1"].."\n" + .."\n" + ..TitanUtils_GetGoldText("all\n") + ..L["TITAN_PANEL_SLASH_ALL_0"].."\n" + ..L["TITAN_PANEL_SLASH_ALL_1"].."\n" + .."", + cmdHidden = true + }, + } + }, + }, +} +------------- + +--============= / Help + +local help_text = "" +do -- set help_text +help_text = "" + ..TitanUtils_GetGreenText("Short Bars: \n") + ..TitanUtils_GetHighlightText("" + .."Short bars are 10 shorter Titan bars that the user can place and change width.\n" + .."- Short bars are independent. They may be used with or without the full width Titan bars.\n" + .."- Open Configuration > Bars to enable and change Bar options.\n" + .."- The default position is the top center under the full width bars. They will be stacked to not overlap.\n" + .."- Move : Use Shift + left mouse and dragging.\n" + .."- Change width by 1 : Use Shift + mouse wheel.\n" + .."- Change width by 10: Use Shift + Ctrl + mouse wheel.\n" + .."- When dragging, best to place your mouse over the left side padding before moving or changing width.\n" + .."- When dragging stops, if the Short Bar is beyond the screen edge the Short Bar should 'snap' to the edge.\n" + .."- Skin : Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n" + .."- Reset : In case a Short bar gets messed up, use Reset Position to place it at original position and width. This does not move plugins.\n" + .."- Min width : Left side padding plus one icon width.\n" + .."- Max width : Screen width.\n" + .."Limitations\n" + .."- There is no 'snap together' or grid for placing Short Bars.\n" + .."\n" + .."- DOWNGRADING from Titan 7.xx to 6.xx - Prior to downgrading, move *any* plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin. Titan 6.xx will throw an error IF any plugin is assigned to ANY Short Bar. If Titan throws an error after a downgrade, wipe the Titan saved variables.\n" + ) + .."\n\n" + ..TitanUtils_GetGreenText("All Bars: \n") + ..TitanUtils_GetHighlightText("" + .."- Bar Right click menu shows the name of the Bar in the menu title corresponding to configuration options.\n" + .."- Hide any Titan bar by using the Bar Right click menu then click Hide.\n" + .."- Titan does not restrict plugins to fit within the visible width. Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n" + .."- Setting a plugin to right-side will use the visible right side; and may overlap with left or center aligned plugins.\n" + .."- Skins : \n" + .."--- Select per Titan bar.\n" + .."--- Select a skin for all Titan bars. This does NOT change the individual Titan bar skin settings.\n" + .."- Hide in Combat : \n" + .."--- Select per Titan bar.\n" + .."--- Hide all Titan bars during combat. This does NOT change the individual Titan bar hide in combat settings.\n" + .."- Bar Order (English): Configuration > Bars shows localized Bar names.\n" + .."--- Top : Always top of screen\n" + .."--- Top 2 : Always under Top Bar\n" + .."--- Bottom 2 : Always above Bottom Bar\n" + .."--- Bottom : Always bottom of screen\n" + .."--- Short 01 - 10 : User placed\n" + ) + .."\n\n" + ..TitanUtils_GetGreenText("Plugins: \n") + ..TitanUtils_GetHighlightText("" + .."Show / Hide Plugins - use one of the methods below:\n" + .."--- Open the right-click Bar menu; find the plugin in a category then click to show / hide the plugin.\n" + .."--- Open Titan Configuration > Plugins then select the plugin by name then check / uncheck Show. If needed, use the Bar dropdown to select the Bar the plugin should be on.\n" + ) + ..TitanUtils_GetHighlightText("" + .."Moving Plugins - use one of the methods below:\n" + .."--- Open the right-click menu; find the plugin in a category then hide then show.\n" + .."--- Drag and drop on another bar or on the same bar.\n" + .."--- Drag and drop on another plugin to swap the plugins.\n" + .."--- Open Titan Configuration > Plugins then check / uncheck Show then use the Bar dropdown and Right / Left buttons.\n" + ) + .."\n\n" +end +--[[ local +NAME: helpBars +DESC: Help for the Titan Panel user +:DESC +--]] +local helpBars = { + name = TITAN_PANEL_CONFIG.topic.help, + type = "group", + args = { + confgendesc = { + name = "Help", + order = 1, + type = "group", inline = true, + args = { + confdesc = { + order = 1, + type = "description", + name = help_text, + cmdHidden = true + }, + } + }, + } +} +------------- + +------------- +--[[ Titan +NAME: TitanUpdateConfig +DESC: This routine will handle the requests to update the various data items in Titan options screens. +VAR: None +OUT: None +NOTE: +- This is called after the plugins are registered in the 'player entering world' event. It can be called again as more plugins are registered. +:NOTE +--]] +function TitanUpdateConfig(action) + if action == "init" then + -- Update the tables for the latest lists + TitanUpdateConfigAddons() + TitanUpdateAddonAttempts() + TitanUpdateExtras() + TitanUpdateChars() + BuildSkins() + BuildBars() + BuildAdj() + end + if action == "nuke" then + local nuked = { + name = "Titan could not initialize properly.", --L["TITAN_DEBUG"], + type = "group", + args = {} + } + + TitanPrint("-- Clearing Titan options...", "warning") + -- Use the same group as below!! +-- AceConfig:RegisterOptionsTable("Titan Panel Main", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Bars", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Globals", nuked) +-- AceConfig:RegisterOptionsTable("Titan Panel Aux Bars", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Frames", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Transparency Control", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Panel Control", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Skin Control", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Skin Custom", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Control", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Attempts", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Extras", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Chars", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Advanced", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Changes", nuked) + AceConfig:RegisterOptionsTable("Titan Panel Addon Slash", nuked) + end +end + + +--[[ +Register the options tables with Ace then register the options with Blizz so the user can use them. +--]] +-- Add Blizzard Configuration Panels +--[[ The first param needs to used for the 'add to options' +The second param must be the table Ace will use to create the user options +--]] +AceConfig:RegisterOptionsTable("Titan Panel Main", titan_entry) +AceConfig:RegisterOptionsTable("Titan Panel Bars", optionsBars) +AceConfig:RegisterOptionsTable("Titan Panel Globals", optionsGlobals) +AceConfig:RegisterOptionsTable("Titan Panel Adjust", optionsAdjust) +AceConfig:RegisterOptionsTable("Titan Panel Frames", optionsFrames) +AceConfig:RegisterOptionsTable("Titan Panel Panel Control", optionsUIScale) +AceConfig:RegisterOptionsTable("Titan Panel Skin Control", optionsSkins) +AceConfig:RegisterOptionsTable("Titan Panel Skin Custom", optionsSkinsCustom) +AceConfig:RegisterOptionsTable("Titan Panel Addon Control", optionsAddons) +AceConfig:RegisterOptionsTable("Titan Panel Addon Attempts", optionsAddonAttempts) +AceConfig:RegisterOptionsTable("Titan Panel Addon Extras", optionsExtras) +AceConfig:RegisterOptionsTable("Titan Panel Addon Chars", optionsChars) +AceConfig:RegisterOptionsTable("Titan Panel Addon Advanced", optionsAdvanced) +AceConfig:RegisterOptionsTable("Titan Panel Addon Changes", changeHistory) +AceConfig:RegisterOptionsTable("Titan Panel Addon Slash", slashHelp) +AceConfig:RegisterOptionsTable("Titan Panel Help", helpBars) +--]] +-- Set the main options pages +--[[ The first param must be the same as the cooresponding 'Ace register' +The second param should be the same as the .name of the cooresponding table that was registered, +if not, any 'open' may fail. +--]] +--AceConfigDialog:AddToBlizOptions("Titan Panel Main", L["TITAN_PANEL"]) +AceConfigDialog:AddToBlizOptions("Titan Panel Main", titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Bars", optionsBars.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Globals", optionsGlobals.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Adjust", optionsAdjust.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Control", optionsAddons.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Chars", optionsChars.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Frames", optionsFrames.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Panel Control", optionsUIScale.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Skin Control", optionsSkins.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Skin Custom", optionsSkinsCustom.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Extras", optionsExtras.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Attempts", optionsAddonAttempts.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Advanced", optionsAdvanced.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Changes", changeHistory.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Addon Slash", slashHelp.name, titan_entry.name) +AceConfigDialog:AddToBlizOptions("Titan Panel Help", helpBars.name, titan_entry.name) diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua index f7b70b2..f60b47b 100644 --- a/Titan/TitanGlobal.lua +++ b/Titan/TitanGlobal.lua @@ -7,7 +7,7 @@ DESC: This file contains the global variables and constants used throughout Tita -- Global variables TITAN_ID = "Titan" -TitanVars = {} -- begin the slow journey to a smaller _G footprint +Titan_Panel = {} -- begin the slow journey to a smaller _G footprint TITAN_DEBUG_ARRAY_MAX = 100 @@ -58,9 +58,9 @@ TITAN_PANEL_BUTTONS_ALIGN_LEFT = 1; TITAN_PANEL_BUTTONS_ALIGN_CENTER = 2; -- Titan plugins are in the form of TitanPanel<id>Button -TitanVars.plugin = {} -TitanVars.plugin.PRE = "TitanPanel" -TitanVars.plugin.POST = "Button" +Titan_Panel.plugin = {} +Titan_Panel.plugin.PRE = "TitanPanel" +Titan_Panel.plugin.POST = "Button" TITAN_PANEL_CONTROL = "TitanPanelBarButton" @@ -95,16 +95,16 @@ TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY = {"Built-ins","General","Combat","Information","Interface","Profession"} -- Bar background types -TitanVars.SKIN = "skin" -TitanVars.COLOR = "color" -TitanVars.NONE = "none" +Titan_Panel.SKIN = "skin" +Titan_Panel.COLOR = "color" +Titan_Panel.NONE = "none" -- For debug across Titan Panel -TitanVars.debug = {} -TitanVars.debug.movable = false -TitanVars.debug.events = false -TitanVars.debug.ldb_setup = false -TitanVars.debug.tool_tips = false -TitanVars.debug.plugin_register = false -TitanVars.debug.plugin_register_deep = false +Titan_Panel.debug = {} +Titan_Panel.debug.movable = false +Titan_Panel.debug.events = false +Titan_Panel.debug.ldb_setup = false +Titan_Panel.debug.tool_tips = false +Titan_Panel.debug.plugin_register = false +Titan_Panel.debug.plugin_register_deep = false diff --git a/Titan/TitanLDB.lua b/Titan/TitanLDB.lua index fb5fbd1..f0a7df9 100644 --- a/Titan/TitanLDB.lua +++ b/Titan/TitanLDB.lua @@ -562,7 +562,7 @@ NOTE: --]] function TitanLDBCreateObject(self, name_str, obj) local name = name_str - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug(tostring(name).." : Attempting to register "); end @@ -574,7 +574,7 @@ function TitanLDBCreateObject(self, name_str, obj) local issue = "LDB request name " .." '"..tostring(name).."'" .." unrecognizable !!!!" - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug(issue); end error (issue) -- get out @@ -592,7 +592,7 @@ function TitanLDBCreateObject(self, name_str, obj) .." '"..tostring(name).."'" .." "..tostring(object).."" .." !!!!" - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug(issue); end error (issue) -- get out @@ -615,7 +615,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 TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug(TITAN_REGISTER_FAILED.." "..issue); end error (issue) @@ -743,7 +743,7 @@ function TitanLDBCreateObject(self, name_str, obj) iconG = (obj.iconG or nil), }; - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug("" .." type: '"..tostring(registry.ldb).."' " ) @@ -815,7 +815,7 @@ print("LDB macrotext" .." "..tostring(obj.commandtext).."" ) --]] - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug("" .." macrotext cmd: '"..tostring(obj.commandtext).."' " ) @@ -885,7 +885,7 @@ print("LDB macrotext" TitanVariables_SyncSinglePluginSettings(registry.id) TitanPanel_InitPanelButtons() -- Show it... end - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug("LDB create" .." "..tostring(pew).."" .." '"..tostring(registry.id).."'" @@ -935,7 +935,7 @@ function LDBToTitan:TitanLDBCreateObject(sender, name, obj) TitanUtils_PluginFail(plugin) end - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug("LDB Create:" -- .." "..tostring(sender).."" .." "..tostring(name).."" @@ -988,7 +988,7 @@ LDBToTitan:SetScript("OnEvent", function(self, event, ...) TitanUtils_PluginFail(plugin) end - if TitanVars.debug.ldb_setup then + if Titan_Panel.debug.ldb_setup then TitanDebug("LDB" .." "..tostring(name).."" .." "..tostring(call_success).."" diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index fbccb3a..52c821f 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -1,9 +1,11 @@ --[[ File NAME: TitanMovable.lua DESC: DragonFlight introduced an Edit Mode for the user to move various frames where they want them. -Titan no longer needs to do this work. +Titan no longer needs to do this work for most frames. -The only routine is an API call so other addons can determine where Titan Panel is on the UI based on user selection - top and bottom bars only. +There are a small number of frames that WoW does not have in Edit mode. These will be added to the table over time as users request. +The scheme has changed to be more like 'move any/thing' which hooks the SetPoint of the frame. +Titan still only allows vertical adjust - not move anywhere. :DESC --]] @@ -66,6 +68,144 @@ function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons return 0 end +--[[ Titan +NAME: TitanPanel_AdjustFrameInit +DESC: Do all the setup needed when a user logs in / reload UI / enter or leave an instance or when user updates adjust flag. +VAR: frame_str : string of the frame name +OUT: None +NOTE: +- This is called once the profile (and settings) are known. +- Keeping this simple for now until omplexity needs to be added. +- hooksecurefunc from https://urbad.net/blue/us/34224257-Guide_to_Secure_Execution_and_Tainting +Hooking and the hooksecurefunc function + +The taint model is the reason that 'hooking' as it is commonly done today can easily break lots of UI functionality, trying to hook a function that is used by secure code causes a tainted function to be called in the middle of an otherwise secure execution path, this then taints the execution path so that nothing following the hook can use secure functions - don't be too dismayed however, we've been given a tool to get around this. + +The new hooksecurefunc API function allows AddOn code to 'post hook' a secure global function, that is run another function after the original one has been run. So for example you could track calls to CastSpellByName using hooksecurefunc("CastSpellByName", mySpellCastTracker). The API replaces the original global function with its own secure hook function that calls the original function, saves its return values away, and then calls your hook function with the same arguments as the original function (any return values from your hook function are thrown away) and then it returns the return values from the original. + +The 'special' feature of this secure hook is that when your hook function is executed, it executes with the taint that was present at the time the hook was created, and when your hook function is done that taint is discarded and the original secure (or possibly tainted - you cannot use hooksecurefunc to REMOVE taint, just avoid it) execution mode is restored. + +- hooksecurefunc from https://wowpedia.fandom.com/wiki/API_hooksecurefunc. +- The hook will stay until a reload or logout. This means the TitanAdj MUST remain or the normal SetPoint will be broken. +- Setting the hook is cumalitive so add ony once; controlled by titan_adj_hook on the frame. +:NOTE +--]] +function TitanPanel_AdjustFrameInit(frame_str) -- + local op = "" + local frame = _G[frame_str] + if frame then -- sanity check + function frame:TitanAdj() + if frame.titan_adj -- only if Titan user has requested + and not InCombatLockdown() then + local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint() + if point and relativeTo and relativePoint and xOfs then + frame:ClearAllPoints() + frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, TitanAdjustSettings[frame_str].offset) + frame.titan_offset = TitanAdjustSettings[frame_str].offset +--[[ +print("TitanAdj ~~" +.." x"..tostring(xOfs).."" +.." y"..tostring(yOfs).."" +.." => "..tostring(TitanAdjustSettings[frame_str].offset).."" +) +--]] + end + end + end + + if frame.titan_adj_hook == true then + -- already hooked, do not want to add more... + else + -- Add the hook for when WoW code updates this frame + hooksecurefunc(frame, "SetPoint", function(frame, ...) + if frame.titan_adjusting then + -- prevent a stack overflow + else + frame.titan_adjusting = true + frame:SetMovable(true) + frame:SetUserPlaced(true) + frame:TitanAdj() -- routine attached to the frame + frame.titan_adjusting = false + end + end) + + frame.titan_adj_hook = true + op = "set secure hook" + end + + TitanPanel_AdjustFrame(frame_str, "Init adjust") + else + op = "skip - frame invalid" + -- do not proceed + end +end + +--[[ Titan +NAME: TitanPanel_AdjustFrame +DESC: Adjust frame as requested. +VAR: frame_str : string of the frame name +VAR: reason : string for debug +OUT: None +NOTE: +- This is called when usesrs has changed the adjust flag and on Titan init. +:NOTE +--]] +function TitanPanel_AdjustFrame(frame_str, reason) -- + local trace = false + local op = "no action" + local frame = _G[frame_str] + + if trace then + print("_AdjustFrame" + .." "..tostring(frame_str).."" + .." '"..tostring(reason).."'" + .." "..tostring(TitanAdjustSettings[frame_str].adjust).."" + .." "..tostring(TitanAdjustSettings[frame_str].offset).."" + ) + end + + if frame then + -- Check if user has requested... + if TitanAdjustSettings[frame_str].adjust then + if frame.titan_adj == true then + -- Already set + else + -- Flipping from false, trigger a move + frame.titan_adj = true + frame:TitanAdj() + op = "adjust - titan_adj to true" + end + + if frame.titan_offset == TitanAdjustSettings[frame_str].offset then + -- No need to update + else + frame:TitanAdj() + op = "adjust - titan_offset changed" + end + else + -- User has requested Titan to NOT adjust this frame. + frame.titan_adj = false + if frame.titan_adj_hook == true then + -- hooked this session so adjust + frame:TitanAdj() + op = "adjust - titan_adj to false" + else + -- not hooked this session so ignore + end + end + else + op = "skip - : frame invalid" + -- do not proceed + end + + if trace then + print("_AdjustFrame" + .." "..tostring(frame_str).."" + .." '"..tostring(op).."'" + ) + end +end + --[[ TitanDebug ("MoveFrame :" .." "..tostring(frame:GetName()) diff --git a/Titan/TitanMovable.lua.bak b/Titan/TitanMovable.lua.bak new file mode 100644 index 0000000..e45e040 --- /dev/null +++ b/Titan/TitanMovable.lua.bak @@ -0,0 +1,222 @@ +--[[ File +NAME: TitanMovable.lua +DESC: 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. + +There are a small number of frames that WoW does not have in Edit mode. These will be added to the table over time as users request. +The scheme has changed to be more like 'move any/thing' which hooks the SetPoint of the frame. +Titan still only allows vertical adjust - not move anywhere. +:DESC + +--]] +-- Globals + +-- Locals +local _G = getfenv(0); +local InCombatLockdown = _G.InCombatLockdown; + + +--[[ API +NAME: TitanMovable_GetPanelYOffset +DESC: Get the Y axis offset Titan needs (1 or 2 bars) at the given position - top or bottom. +VAR: framePosition - TITAN_PANEL_PLACE_TOP or TITAN_PANEL_PLACE_BOTTOM +OUT: Y axis offset, in pixels +NOTE: +- As of DragonFlight this may not be as useful. Leaving to not break any addons. + +- The preferred method to determine the Y offset needed to use TitanUtils_GetBarAnchors() +which provides anchors (frames) for an addon to use. +:NOTE +--]] +function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons + -- Both top & bottom are figured out but only the + -- requested position is returned + local barnum_top = 0 + local barnum_bot = 0 + -- If user has the top set then determine the top offset + if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."Bar"].show then +-- if TitanPanelGetVar("Bar_Show") then + barnum_top = 1 + end + if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."Bar2"].show then +-- if TitanPanelGetVar("Bar2_Show") then + barnum_top = 2 + end + -- If user has the bottom set then determine the bottom offset + if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."AuxBar"].show then +-- if TitanPanelGetVar("AuxBar_Show") then + barnum_bot = 1 + end + + if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2"].show then +-- if TitanPanelGetVar("AuxBar2_Show") then + barnum_bot = 2 + end + + local scale = TitanPanelGetVar("Scale") + -- return the requested offset + -- 0 will be returned if the user has no bars showing + -- or the scale is not valid + if scale and framePosition then + if framePosition == TITAN_PANEL_PLACE_TOP and barnum_top > 0 then + return (-TITAN_PANEL_BAR_HEIGHT * scale)*(barnum_top); + elseif framePosition == TITAN_PANEL_PLACE_BOTTOM and barnum_bot > 0 then + return (TITAN_PANEL_BAR_HEIGHT * scale)*(barnum_bot) + -1 -- no idea why -1 is needed... seems anchoring to bottom is off a pixel + end + end + return 0 +end + +--[[ Titan +NAME: TitanPanel_AdjustFrameInit +DESC: Do all the setup needed when a user logs in / reload UI / enter or leave an instance or when user updates adjust flag. +VAR: frame_str : string of the frame name +OUT: None +NOTE: +- This is called once the profile (and settings) are known. +- Keeping this simple for now until omplexity needs to be added. +- hooksecurefunc from https://urbad.net/blue/us/34224257-Guide_to_Secure_Execution_and_Tainting +Hooking and the hooksecurefunc function + +The taint model is the reason that 'hooking' as it is commonly done today can easily break lots of UI functionality, trying to hook a function that is used by secure code causes a tainted function to be called in the middle of an otherwise secure execution path, this then taints the execution path so that nothing following the hook can use secure functions - don't be too dismayed however, we've been given a tool to get around this. + +The new hooksecurefunc API function allows AddOn code to 'post hook' a secure global function, that is run another function after the original one has been run. So for example you could track calls to CastSpellByName using hooksecurefunc("CastSpellByName", mySpellCastTracker). The API replaces the original global function with its own secure hook function that calls the original function, saves its return values away, and then calls your hook function with the same arguments as the original function (any return values from your hook function are thrown away) and then it returns the return values from the original. + +The 'special' feature of this secure hook is that when your hook function is executed, it executes with the taint that was present at the time the hook was created, and when your hook function is done that taint is discarded and the original secure (or possibly tainted - you cannot use hooksecurefunc to REMOVE taint, just avoid it) execution mode is restored. + +- hooksecurefunc from https://wowpedia.fandom.com/wiki/API_hooksecurefunc. +- The hook will stay until a reload or logout. This means the TitanAdj MUST remain or the normal SetPoint will be broken. +- Setting the hook is cumalitive so add ony once; controlled by titan_adj_hook on the frame. +:NOTE +--]] +function TitanPanel_AdjustFrameInit(frame_str) -- + local op = "" + local frame = _G[frame_str] + if frame then -- sanity check + function frame:TitanAdj() + if frame.titan_adj -- only if Titan user has requested + and not InCombatLockdown() then + local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint() + if point and relativeTo and relativePoint and xOfs then + frame:ClearAllPoints() + frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, TitanAdjustSettings[frame_str].offset) + frame.titan_offset = TitanAdjustSettings[frame_str].offset +---[[ +print("TitanAdj ~~" +.." x"..tostring(xOfs).."" +.." y"..tostring(yOfs).."" +.." => "..tostring(TitanAdjustSettings[frame_str].offset).."" +) +--]] + end + end + end + + if frame.titan_adj_hook == true then + -- already hooked, do not want to add more... + else + -- Add the hook for when WoW code updates this frame + hooksecurefunc(frame, "SetPoint", function(frame, ...) + if frame.titan_adjusting then + -- prevent a stack overflow + else + frame.titan_adjusting = true + frame:SetMovable(true) + frame:SetUserPlaced(true) + frame:TitanAdj() -- routine attached to the frame + frame.titan_adjusting = false + end + end) + + frame.titan_adj_hook = true + op = "set secure hook" + end + + TitanPanel_AdjustFrame(frame_str, "Init adjust") + else + op = "skip - frame invalid" + -- do not proceed + end +end + +--[[ Titan +NAME: TitanPanel_AdjustFrame +DESC: Adjust frame as requested. +VAR: frame_str : string of the frame name +VAR: reason : string for debug +OUT: None +NOTE: +- This is called when usesrs has changed the adjust flag and on Titan init. +:NOTE +--]] +function TitanPanel_AdjustFrame(frame_str, reason) -- + local trace = true + local op = "no action" + local frame = _G[frame_str] + + if trace then + print("_AdjustFrame" + .." "..tostring(frame_str).."" + .." '"..tostring(reason).."'" + .." "..tostring(TitanAdjustSettings[frame_str].adjust).."" + .." "..tostring(TitanAdjustSettings[frame_str].offset).."" + ) + end + + if frame then + -- Check if user has requested... + if TitanAdjustSettings[frame_str].adjust then + if frame.titan_adj == true then + -- Already set + else + -- Flipping from false, trigger a move + frame.titan_adj = true + frame:TitanAdj() + op = "adjust - titan_adj to true" + end + + if frame.titan_offset == TitanAdjustSettings[frame_str].offset then + -- No need to update + else + frame:TitanAdj() + op = "adjust - titan_offset changed" + end + else + -- User has requested Titan to NOT adjust this frame. + frame.titan_adj = false + if frame.titan_adj_hook == true then + -- hooked this session so adjust + frame:TitanAdj() + op = "adjust - titan_adj to false" + else + -- not hooked this session so ignore + end + end + else + op = "skip - : frame invalid" + -- do not proceed + end + + if trace then + print("_AdjustFrame" + .." "..tostring(frame_str).."" + .." '"..tostring(op).."'" + ) + end +end + +--[[ + TitanDebug ("MoveFrame :" + .." "..tostring(frame:GetName()) + .." point:"..tostring(point) + .." relativeTo:"..tostring(relativeTo:GetName()) + .." relativePoint:"..tostring(relativePoint) + .." xOfs:"..tostring(xOfs) + .." y:"..tostring(y) + .." adj:"..tostring(DoAdjust(top_bottom, force)) + .." tb:"..tostring(top_bottom) + .." f:"..tostring(force) + ) + end +--]] \ No newline at end of file diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index c06aaa0..ab5b3ce 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -42,7 +42,7 @@ OUT: string - The button / frame name --]] function TitanUtils_ButtonName(id) if (id) then - return TitanVars.plugin.PRE..id..TitanVars.plugin.POST + return Titan_Panel.plugin.PRE..id..Titan_Panel.plugin.POST else return nil end @@ -57,7 +57,7 @@ OUT: string - The id of the plugin --]] function TitanUtils_GetButton(id) -- Used by plugins if (id) then - return _G[TitanVars.plugin.PRE..id..TitanVars.plugin.POST], id; + return _G[Titan_Panel.plugin.PRE..id..Titan_Panel.plugin.POST], id; else return nil, nil; end @@ -96,7 +96,7 @@ OUT: string - plugin id or nil --]] function TitanUtils_GetButtonID(name) if name then - local s, e, id = string.find(name, TitanVars.plugin.PRE.."(.*)"..TitanVars.plugin.POST); + local s, e, id = string.find(name, Titan_Panel.plugin.PRE.."(.*)"..Titan_Panel.plugin.POST); return id; else return nil; @@ -1385,7 +1385,7 @@ function TitanUtils_PluginToRegister(self, isChildButton) "UIDropDownMenuTemplate") -- Debug - if TitanVars.debug.plugin_register then + if Titan_Panel.debug.plugin_register then TitanDebug("Queue Plugin" -- .." '"..tostring(self:GetName()).."'" .." '"..tostring(TitanUtils_GetButtonID(self:GetName())).."'" @@ -1587,7 +1587,7 @@ local function TitanUtils_RegisterPluginProtected(plugin) end -- Debug - if TitanVars.debug.plugin_register then + if Titan_Panel.debug.plugin_register then TitanDebug("Plugin RegProt" -- .." '"..tostring(self:GetName()).."'" .." '"..tostring(id).."'" @@ -1667,7 +1667,7 @@ function TitanUtils_RegisterPlugin(plugin) end -- Debug - if TitanVars.debug.plugin_register then + if Titan_Panel.debug.plugin_register then local status = plugin.status if plugin.status == TITAN_REGISTER_FAILED then status = TitanUtils_GetRedText(status) @@ -1764,7 +1764,7 @@ local function TitanRightClickMenu_OnLoad(self) UIDropDownMenu_Initialize(self, prepareFunction, "MENU"); end else - if TitanVars.debug.tool_tips then + if Titan_Panel.debug.tool_tips then TitanDebug("Could not display tooltip. " .."Could not determine Titan ID for " .."'"..(self:GetName() or "?").."'. " diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index bc5dfbc..05f4ba1 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -17,7 +17,8 @@ TitanPlayerSettings = TitanSettings.Players[toon] TitanPluginSettings = TitanSettings.Players[toon].Plugins : Successful registered plugins with all flags TitanPanelSettings = TitanSettings.Players[toon].Panel : ** TitanPanelRegister = TitanSettings.Players[toon].Register : .registry of all plugins (Titan and LDB) to be registered with Titan -TitanBarDataVars ^^= TitanSettings.Players[toon].BarVars : Titan user selected placement info +TitanBarDataVars ^^= TitanSettings.Players[toon].BarVars : Titan user selected placement info +TitanAdjustSettings = TitanSettings.Players[toon].Adjust : List of frames Titan can adjust, vertically only ** : - Has Plugin placement data under Location and Buttons @@ -276,13 +277,13 @@ TitanBarVarsDefaults = { { skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.NONE, -- TitanVars.NONE or TitanVars.SKIN or TitanVars.COLOR + texure = Titan_Panel.NONE, -- Titan_Panel.NONE or Titan_Panel.SKIN or Titan_Panel.COLOR hide_in_combat = false, }, [TITAN_PANEL_DISPLAY_PREFIX.."Bar"] = {off_x=0, off_y=0, off_w = x_max, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, -- or TitanVars.COLOR + texure = Titan_Panel.SKIN, -- or Titan_Panel.COLOR show = true, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -291,7 +292,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Bar2"] = {off_x=0, off_y=-(TITAN_PANEL_BAR_HEIGHT), off_w = x_max, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -300,7 +301,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2"] = {off_x=0, off_y=(TITAN_PANEL_BAR_HEIGHT * 2), off_w = x_max, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -309,7 +310,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."AuxBar"] = {off_x=0, off_y=(TITAN_PANEL_BAR_HEIGHT), off_w = x_max, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -318,7 +319,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short01"] = {off_x=x_mid, off_y=Calc_Y(3), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -327,7 +328,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short02"] = {off_x=x_mid, off_y=Calc_Y(4), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -336,7 +337,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short03"] = {off_x=x_mid, off_y=Calc_Y(5), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -345,7 +346,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short04"] = {off_x=x_mid, off_y=Calc_Y(6), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -354,7 +355,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short05"] = {off_x=x_mid, off_y=Calc_Y(7), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -363,7 +364,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short06"] = {off_x=x_mid, off_y=Calc_Y(8), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -372,7 +373,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short07"] = {off_x=x_mid, off_y=Calc_Y(9), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -381,7 +382,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short08"] = {off_x=x_mid, off_y=Calc_Y(10), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -390,7 +391,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short09"] = {off_x=x_mid, off_y=Calc_Y(11), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -399,7 +400,7 @@ TitanBarVarsDefaults = { [TITAN_PANEL_DISPLAY_PREFIX.."Short10"] = {off_x=x_mid, off_y=Calc_Y(12), off_w = SHORT_WIDTH, skin = {path = "Interface\\AddOns\\Titan\\Artwork\\", alpha = 0.7}, color = {r = 1.0, g = .5, b = 1.0, alpha = 1.0}, - texure = TitanVars.SKIN, + texure = Titan_Panel.SKIN, show = false, auto_hide = false, align = TITAN_PANEL_BUTTONS_ALIGN_LEFT, -- TITAN_PANEL_BUTTONS_ALIGN_CENTER @@ -407,6 +408,18 @@ TitanBarVarsDefaults = { }, } +local TitanAdjDefaults = { + adjust = false, + offset = 0, +} +Titan_Panel.AdjList = { -- TODO : localize + ["UIWidgetTopCenterContainerFrame"] = { + frame_name = "UIWidgetTopCenterContainerFrame", + purpose = "Status for BG / Dungeon", + }, +} +TitanAdjustSettings = {} -- holds frames that Titan allows user to adjust + -- Timers used within Titan TitanTimers = {} @@ -773,10 +786,10 @@ VAR: None OUT: None --]] function TitanVariables_SyncPluginSettings() -- one plugin uses this + -- Init / sync every plugin for id, plugin in pairs(TitanPlugins) do if (plugin and plugin.savedVariables) then - -- Init / sync every plugin - TitanVariables_SyncSinglePluginSettings(id) + TitanVariables_SyncSinglePluginSettings(id) -- sync this plugin else -- Remove plugin savedVariables table if there's one if (TitanPluginSettings[id]) then @@ -786,6 +799,28 @@ function TitanVariables_SyncPluginSettings() -- one plugin uses this end end +local function Titan_SyncAdjList() + -- Using Titan list, walk saved vars to add adjustable frames + for frame, v in pairs(Titan_Panel.AdjList) do + if TitanAdjustSettings[frame] then + -- No action needed + -- If default adds more elements (more data), they will need to be coded here. + else + TitanAdjustSettings[frame] = TitanAdjDefaults -- Init the saved vars + end + end + + -- Using saved vars, walk Titan list to remove frames no longer adjustable + for frame, v in pairs(TitanAdjustSettings) do + if Titan_Panel.AdjList[frame] then + -- No action needed + -- frame is adjustable + else + TitanAdjustSettings[frame] = nil -- Remove, no longer adjustable + end + end +end + --[[ Titan NAME: TitanVariables_InitTitanSettings DESC: Ensure TitanSettings (one of the saved vars in the toc) exists and set the Titan version. @@ -828,16 +863,16 @@ function TitanVariables_InitTitanSettings() -- Current Titan list known - all toons player has profiles for -- Sort in alphabetical order. -- Used for menus. - TitanVars.players = {} + Titan_Panel.players = {} for idx, v in pairs (TitanSettings.Players) do - table.insert(TitanVars.players, idx) + table.insert(Titan_Panel.players, idx) end - table.sort(TitanVars.players, function(a, b) + table.sort(Titan_Panel.players, function(a, b) return a < b end) --[===[ -for idx = 1, #TitanVars.players do - print("["..idx.."] : '"..TitanVars.players[idx].."'") +for idx = 1, #Titan_Panel.players do + print("["..idx.."] : '"..Titan_Panel.players[idx].."'") end --]===] @@ -951,7 +986,7 @@ local function Set_bar_vars(to_profile) BV[idx].auto_hide = panel[v.name.."_Hide"] BV[idx].align = panel[v.name.."_Align"] -- only skins before 7.x - BV[idx].texure = TitanVars.SKIN + BV[idx].texure = Titan_Panel.SKIN BV[idx].skin.alpha = panel[v.name.."_Transparency"] BV[idx].skin.path = panel["TexturePath"] end @@ -1014,6 +1049,7 @@ local function Init_player_settings(from_profile, to_profile, action) TitanPlayerSettings["Panel"] = {} TitanPlayerSettings["Register"] = {} TitanPlayerSettings["BarVars"] = TitanBarVarsDefaults -- New Mar 2023 + TitanPlayerSettings["Adjust"] = {} -- New May 2023 new_toon = true end @@ -1023,9 +1059,24 @@ local function Init_player_settings(from_profile, to_profile, action) TitanPanelSettings = TitanPlayerSettings["Panel"]; TitanVariables_SyncRegisterSavedVariables(TITAN_PANEL_SAVED_VARIABLES, TitanPanelSettings) - -- New Mar 2023 : TitanSettings.Players[player].BarData to hold Short bar data - Set_bar_vars(to_profile) + -- ====== New May 2023 : Back to adjusting a couple frames per user settings + -- Could be new toon / ... + if TitanPlayerSettings["Adjust"] then + -- No action needed + else + TitanPlayerSettings["Adjust"] = {} + end + TitanAdjustSettings = TitanPlayerSettings["Adjust"] + Titan_SyncAdjList() + -- The player settings are known, init the adjustable frames + for idx, v in pairs (Titan_Panel.AdjList) do + TitanPanel_AdjustFrameInit(idx) + end + -- ====== + -- ====== 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 = {} diff --git a/TitanBag/TitanBag.toc b/TitanBag/TitanBag.toc index 46208ad..d4f0f2a 100644 --- a/TitanBag/TitanBag.toc +++ b/TitanBag/TitanBag.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fBag|r] |cff00aa007.01.00.100100|r ## Notes: Adds bag and free slot information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanBag.lua diff --git a/TitanClock/TitanClock.toc b/TitanClock/TitanClock.toc index 3e18ccb..7a7a542 100644 --- a/TitanClock/TitanClock.toc +++ b/TitanClock/TitanClock.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fClock|r] |cff00aa007.01.00.100100|r ## Notes: Adds a clock to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanClock.lua diff --git a/TitanGold/TitanGold.toc b/TitanGold/TitanGold.toc index 1a0c4cc..b4a39df 100644 --- a/TitanGold/TitanGold.toc +++ b/TitanGold/TitanGold.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fGold|r] |cff00aa007.01.00.100100|r ## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: GoldSave ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanGold.lua diff --git a/TitanLocation/TitanLocation.toc b/TitanLocation/TitanLocation.toc index 92c90ba..a44828e 100644 --- a/TitanLocation/TitanLocation.toc +++ b/TitanLocation/TitanLocation.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa007.01.00.100100|r ## Notes: Adds coordinates and location information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanLocation.lua diff --git a/TitanLootType/TitanLootType.toc b/TitanLootType/TitanLootType.toc index 9445e7d..ba4dbbb 100644 --- a/TitanLootType/TitanLootType.toc +++ b/TitanLootType/TitanLootType.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa007.01.00.100100|r ## Notes: Adds group loot and instance difficulty information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanLootType.lua diff --git a/TitanPerformance/TitanPerformance.toc b/TitanPerformance/TitanPerformance.toc index b923cca..2cafb6e 100644 --- a/TitanPerformance/TitanPerformance.toc +++ b/TitanPerformance/TitanPerformance.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa007.01.00.100100|r ## Notes: Adds FPS and Garbage collection information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanPerformance.lua diff --git a/TitanRepair/TitanRepair.toc b/TitanRepair/TitanRepair.toc index 7f1cf07..fb1e472 100644 --- a/TitanRepair/TitanRepair.toc +++ b/TitanRepair/TitanRepair.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa007.01.00.100100|r ## Notes: Provides a configurable durability display. Also adds the ability to auto repair items and inventory at vendors. Adds selling of grey items. ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanRepair.lua diff --git a/TitanVolume/TitanVolume.toc b/TitanVolume/TitanVolume.toc index a983405..8178b55 100644 --- a/TitanVolume/TitanVolume.toc +++ b/TitanVolume/TitanVolume.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa007.01.00.100100|r ## Notes: Adds a volume control icon on your Titan Bar ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanVolume.lua diff --git a/TitanXP/TitanXP.toc b/TitanXP/TitanXP.toc index 3a3f504..455722b 100644 --- a/TitanXP/TitanXP.toc +++ b/TitanXP/TitanXP.toc @@ -1,10 +1,10 @@ ## Interface: 100100 -## Title: Titan Panel [|cffeda55fXP|r] |cff00aa007.00.03.100100|r +## Title: Titan Panel [|cffeda55fXP|r] |cff00aa007.01.00.100100|r ## Notes: Adds information to Titan Panel about XP earned and time to level ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: ## OptionalDeps: ## Dependencies: Titan -## Version: 7.00.03.100100 +## Version: 7.01.00.100100 ## X-Child-Of: Titan TitanXP.lua