From 3a8502b06fc1fa1e4094bb1fc5f5eef39f71fada Mon Sep 17 00:00:00 2001 From: urnati Date: Mon, 10 Nov 2025 08:48:03 -0500 Subject: [PATCH] - Added export / import of profiles - Added compress and serialize libs for export / import - lib cleanup --- Titan/Titan.lua | 2 + Titan/Titan.toc | 1 + Titan/TitanConfig.lua | 242 ++++- Titan/TitanGlobal.lua | 12 +- Titan/TitanUtils.lua | 248 +++-- Titan/TitanVariables.lua | 104 +- .../AceGUI-3.0-SharedMediaWidgets.toc | 16 - .../BackgroundWidget.lua | 235 ----- .../AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua | 230 ----- .../AceGUI-3.0-SharedMediaWidgets/FontWidget.lua | 216 ----- .../AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua | 264 ----- .../StatusbarWidget.lua | 233 ----- .../AceGUI-3.0-SharedMediaWidgets/prototypes.lua | 266 ----- .../AceGUI-3.0-SharedMediaWidgets/widget.xml | 9 - .../Ace/AceGUI-3.0-SharedMediaWidgets/CHANGES.txt | 12 - .../Libs/AceGUI-3.0/AceGUI-3.0.lua | 1026 -------------------- .../Libs/AceGUI-3.0/AceGUI-3.0.xml | 28 - .../widgets/AceGUIContainer-BlizOptionsGroup.lua | 138 --- .../widgets/AceGUIContainer-DropDownGroup.lua | 157 --- .../AceGUI-3.0/widgets/AceGUIContainer-Frame.lua | 316 ------ .../widgets/AceGUIContainer-InlineGroup.lua | 103 -- .../widgets/AceGUIContainer-ScrollFrame.lua | 215 ---- .../widgets/AceGUIContainer-SimpleGroup.lua | 69 -- .../widgets/AceGUIContainer-TabGroup.lua | 349 ------- .../widgets/AceGUIContainer-TreeGroup.lua | 715 -------------- .../AceGUI-3.0/widgets/AceGUIContainer-Window.lua | 336 ------- .../AceGUI-3.0/widgets/AceGUIWidget-Button.lua | 103 -- .../AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua | 296 ------ .../widgets/AceGUIWidget-ColorPicker.lua | 190 ---- .../widgets/AceGUIWidget-DropDown-Items.lua | 471 --------- .../AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua | 737 -------------- .../AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua | 263 ----- .../AceGUI-3.0/widgets/AceGUIWidget-Heading.lua | 78 -- .../Libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua | 140 --- .../widgets/AceGUIWidget-InteractiveLabel.lua | 94 -- .../AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua | 249 ----- .../Libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua | 179 ---- .../widgets/AceGUIWidget-MultiLineEditBox.lua | 366 ------- .../AceGUI-3.0/widgets/AceGUIWidget-Slider.lua | 284 ------ .../CallbackHandler-1.0/CallbackHandler-1.0.lua | 239 ----- .../CallbackHandler-1.0/CallbackHandler-1.0.xml | 4 - .../Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua | 300 ------ .../Libs/LibSharedMedia-3.0/lib.xml | 4 - .../Libs/LibStub/LibStub.lua | 30 - .../Libs/LibStub/LibStub.toc | 9 - .../Ace/AceGUI-3.0-SharedMediaWidgets/widget.xml | 4 - .../Ace/AceSerializer-3.0/AceSerializer-3.0.lua | 287 ++++++ .../Ace/AceSerializer-3.0/AceSerializer-3.0.xml | 4 + 48 files changed, 827 insertions(+), 9046 deletions(-) delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets.toc delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BackgroundWidget.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/FontWidget.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/StatusbarWidget.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/prototypes.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/widget.xml delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/CHANGES.txt delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/AceGUI-3.0.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/AceGUI-3.0.xml delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-DropDownGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-Frame.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-TabGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-Window.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/LibSharedMedia-3.0/lib.xml delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/LibStub/LibStub.lua delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/Libs/LibStub/LibStub.toc delete mode 100644 Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/widget.xml create mode 100644 Titan/libs/Ace/AceSerializer-3.0/AceSerializer-3.0.lua create mode 100644 Titan/libs/Ace/AceSerializer-3.0/AceSerializer-3.0.xml diff --git a/Titan/Titan.lua b/Titan/Titan.lua index fd1776e..d355eba 100644 --- a/Titan/Titan.lua +++ b/Titan/Titan.lua @@ -501,6 +501,7 @@ end ---Titan Handle PLAYER_LOGOUT On logout, set some debug data in saved variables. function TitanPanelBarButton:PLAYER_LOGOUT() + --[[ if not IsTitanPanelReset then -- for debug if TitanPanelRegister then @@ -509,6 +510,7 @@ function TitanPanelBarButton:PLAYER_LOGOUT() TitanPanelRegister.TitanPlugins = TitanPlugins end end + --]] Titan__InitializedPEW = false end diff --git a/Titan/Titan.toc b/Titan/Titan.toc index 6320bcb..8ab4099 100644 --- a/Titan/Titan.toc +++ b/Titan/Titan.toc @@ -31,6 +31,7 @@ libs\Ace\LibStub\LibStub.lua libs\Ace\CallbackHandler-1.0\CallbackHandler-1.0.xml libs\Ace\AceAddon-3.0\AceAddon-3.0.xml libs\Ace\AceHook-3.0\AceHook-3.0.xml +libs\Ace\AceSerializer-3.0\AceSerializer-3.0.xml libs\Ace\AceTimer-3.0\AceTimer-3.0.xml libs\Ace\AceGUI-3.0\AceGUI-3.0.xml libs\Ace\AceConfig-3.0\AceConfig-3.0.xml diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 5af81eb..dbe9406 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -35,6 +35,7 @@ TITAN_PANEL_CONFIG = { slash = L["TITAN_PANEL_MENU_SLASH_COMMAND"], -- help = L["TITAN_PANEL_MENU_HELP"], help_list = "Help List", --L["TITAN_PANEL_MENU_HELP"], + im_ex_port = "Import / Export", --L["TITAN_PANEL_MENU_HELP"], adjust = "Frame Adjustment", } } @@ -1643,6 +1644,239 @@ local function TitanUpdateChars() end ------------- +--============= Import / Export Profiles + +---The toon profile import / exportsa will be added here +local optionsImportExport = { + name = TITAN_PANEL_CONFIG.topic.im_ex_port, + type = "group", + args = {} +} +local export_str = "" -- hold export string +local import_str = "" -- hold import string + +---Allow the user to load / delete / reset / sync profile data +local function TitanToonList() + local players = {} -- used for list of profiles + local export = {} -- used for selected profiles + local p_info = {} -- used to hold info about each toon in players + + -- Rip through the players (with server name) to sort them + for index, id in pairs(TitanSettings.Players) do +-- table.insert(players, {index = index}); +-- table.insert(export, {index = false}); + players[index] = index + export[index] = false + + -- collect some info on THIS toon for the config + local this_toon = {} + + local _, server = TitanUtils_ParseName(index) + -- color code the name + -- - gold for normal profiles + -- - green for custom profiles + if server == TITAN_CUSTOM_PROFILE_POSTFIX then + this_toon.fancy_name = TitanUtils_GetGreenText((index or "?")) + else + this_toon.fancy_name = TitanUtils_GetGoldText((index or "?")) + end + + this_toon.name = index + this_toon.is_player = (index == TitanUtils_GetPlayer()) + this_toon.sync_set = not (id.Panel["SyncWithProfile"] == Titan_Global.profile.NONE) + this_toon.sync_name = id.Panel["SyncWithProfile"] + table.insert(p_info, this_toon) -- table index matches players table... + + end + --Ace or Blizz sorts the toons... + -- table.sort(players, function(a, b) + -- return a < b + -- end) +--TitanDumpTable(players) +--TitanDumpTable(export) + -- set up the options for the user + local args = optionsImportExport.args + + wipe(args) + local position = 100 +--[[ + local header = "" + header = header .. L["TITAN_PANEL_CHARS_DESC"] .. "\n" + + position = position + 1 + args["desc"] = { + order = position, + type = "description", + name = header .. "\n", + cmdHidden = true, + } +--]] + position = position + 1 + args["export_header"] = { + order = position, + type = "header", + name = "Export \n", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + cmdHidden = true + } + local ex_desc = "" + .."To create a Titan Export : \n" + .."Select the toons you want to export. \n" + .."Click Export - Ignore the Accept button, it is part of the Ace lib.\n" + .."To copy the string from the Export box; Click in the Export box; Then control-A; Then control-C.\n" + .."Paste (control-V) the string somewhere safe. Ensure no stray characters will be added. \n" + position = position + 1 + args["exportdesc"] = { + order = position, + type = "description", + name = ex_desc, -- .. "\n", + cmdHidden = true, + } + position = position + 1 + args["export_multi"] = { + order = position, + type = "multiselect", + name = "", --"Export", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + desc = "", --"Select all the toons you want to export.", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", +-- cmdHidden = true, +-- style = "radio", + values = players, + get = function(info, v) + -- Get from list... + local toon = v + local res = export[toon] + + local str = "Export get :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(res) .. "" + Titan_Debug.Out('titan', 'profile', str) + + return res + end, + set = function(info, v, k) + -- Put in list... + local toon = v + export[toon] = k + local res = export[toon] + + local str = "Import get :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(res) .. "" + Titan_Debug.Out('titan', 'profile', str) + end, + } + + position = position + 1 + args["export_cmd"] = { + name = "Export", --L["TITAN_PANEL_MENU_LOAD_SETTINGS"], + desc = "Export the selected toons", --L["TITAN_PANEL_MENU_LOAD_SETTINGS_DESC"], + order = position, + type = "execute", + func = function(info, v) + TitanDumpTable(export) + export_str = TitanVariables_CreateExport(export, false) + end, + } + + position = position + 1 + args["export_text"] = { + order = position, + type = "input", + name = "Export box", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + desc = "To copy the string; Click in the string; Then control-A; Then control-C", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + multiline = 10, + width = 'full', + get = function(info, v) + + local str = "Export str get :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(string.len(export_str)) .. "" + Titan_Debug.Out('titan', 'profile', str) + + return export_str + end, + set = function(info, v, k) + export_str = v + + local str = "Export str set :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(string.len(export_str)) .. "" + .. " k'"..tostring(k).."'" + Titan_Debug.Out('titan', 'profile', str) + end, + } + + position = position + 1 + args["import_header"] = { + order = position, + type = "header", + name = "Import \n", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + cmdHidden = true + } + local im_desc = "" + .."To Import a Titan export : \n" + .."Copy (control-C) the Titan Export from a safe source.\n" + .."Click in the Import box; Then control-A; then Paste (control-V).\n" + .."Click Accept to trigger the Import. The text will disappear!\n" + .."Click Import : If successful Titan will Reload to ensure the Import is saved and operational. \n" + position = position + 1 + args["importdesc"] = { + order = position, + type = "description", + name = im_desc, -- .. "\n", + cmdHidden = true, + } + + position = position + 1 + args["import_text"] = { + order = position, + type = "input", + name = "Import box", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + desc = "To copy the export string; Click in the box; Then control-V", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + width = 'full', + multiline = 10, + get = function(info, v) + local str = "Import str set :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(string.len(import_str)) .. "" + Titan_Debug.Out('titan', 'profile', str) + + return "" + end, + set = function(info, v, k) + import_str = v + + local str = "Import str set :" + str = str + .. " " .. tostring(v) .. "" + .. " " .. tostring(string.len(import_str)) .. "" + .. " k'"..tostring(k).."'" + Titan_Debug.Out('titan', 'profile', str) + end, + } + position = position + 1 + args["import_cmd"] = { + name = "Import", --L["TITAN_PANEL_MENU_LOAD_SETTINGS"], + desc = "Import the Titan export in the input box.", --L["TITAN_PANEL_MENU_PROFILES"] .. "\n", + order = position, + type = "execute", + func = function(info, v) + -- FORMAT export into proper form!!!! + local ok = TitanVariables_ProcessImport(import_str) + if ok then + ReloadUI() + else + -- User should have been given an error msg + end + end, + } +end +------------- + --============= Tooltips and Frames --[[ local @@ -3104,7 +3338,6 @@ local function BuildHelpList() end ------------- - ------------- ---Build the entire Config table Ace will display @@ -3114,6 +3347,7 @@ local function BuildAll() TitanUpdateAddonAttempts() TitanUpdateExtras() TitanUpdateChars() + TitanToonList() BuildSkins() BuildBars() BuildBarsAll() @@ -3176,9 +3410,10 @@ do -- Register Titan main options list 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 Im_Ex", optionsImportExport) 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 Addon Slash", slashHelp) AceConfig:RegisterOptionsTable("Titan Panel Help List", helplist) end @@ -3194,6 +3429,7 @@ do -- Register the options for each entry in Titan option list 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 Addon Im_Ex", optionsImportExport.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) @@ -3202,6 +3438,6 @@ do -- Register the options for each entry in Titan option list 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 Addon Slash", slashHelp.name, titan_entry.name) AceConfigDialog:AddToBlizOptions("Titan Panel Help List", helplist.name, titan_entry.name) end diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua index 75320e3..3d4d86b 100644 --- a/Titan/TitanGlobal.lua +++ b/Titan/TitanGlobal.lua @@ -69,7 +69,7 @@ TitanPlayerSettings = nil TitanPluginSettings = nil; -- Used by plugins TitanPanelSettings = nil; -Titan_Global.players = "" +Titan_Global.players = {} TITAN_PANEL_UPDATE_BUTTON = 1; TITAN_PANEL_UPDATE_TOOLTIP = 2; @@ -167,6 +167,13 @@ Titan_Global.SKIN = "skin" Titan_Global.COLOR = "color" Titan_Global.NONE = "none" +-- Profile types +Titan_Global.profile = {} +Titan_Global.profile.GLOBAL = "global" +Titan_Global.profile.SYNC = "sync" +Titan_Global.profile.TOON = "toon" +Titan_Global.profile.NONE = "<>" + -- For WoW localized strings / literals we are using Titan_Global.literals = { low = LOW, @@ -176,6 +183,9 @@ Titan_Global.literals = { help = HELP_LABEL, mute = MUTE, muted = MUTED, + pvp = PVP, + use = USE, + note = LABEL_NOTE, } Titan_Global.colors = { diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 0fdf099..3803273 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -49,7 +49,7 @@ local drop_down_1 = "" -- changes if using Blizz drop down (retail) or lib (Clas drop_down_1 = "DropDownList1" -- Boo!! Per hard-coded Blizz UIDropDownMenu.lua --[[ -This set of routines controls the menu timer. +This set of routines controls the menu timer. It keeps the menu open as long as the mouse is over an open menu or sub menu. The timer is only on the top (drop_down_1) NOT on any sub menu. @@ -58,15 +58,15 @@ We cannot reliably use OnEnter / OnLeave only because the user may leave the mou The OnUpdate must do the 'over menu' check. --]] local function IsMouseOverMenu() - for idx = 1, UIDROPDOWNMENU_MAXLEVELS do -- + for idx = 1, UIDROPDOWNMENU_MAXLEVELS do -- if _G["DropDownList" .. idx]:IsMouseOver() then ---[[ + --[[ print("TU _Mouse on menu" .." "..tostring(idx).."" .." / "..tostring(UIDROPDOWNMENU_MAXLEVELS).."" ) --]] - return true -- + return true -- else -- not over, keep checking end @@ -80,26 +80,26 @@ local tstr = "" ---@param self Frame ---@param elapsed number local function OnUpdateTimer(self, elapsed) - local str = "Counting" .." "..tostring(self:GetName()).." " + local str = "Counting" .. " " .. tostring(self:GetName()) .. " " if (not self.showTimer or not self.isCounting) then -- no timer running str = str .. "no timer" --- return; + -- return; elseif (self.showTimer < 0) then -- timer expired str = str .. "expired" self:Hide(); self.showTimer = nil; self.isCounting = nil; - elseif IsMouseOverMenu() then -- mouse is over some (sub)menu + elseif IsMouseOverMenu() then -- mouse is over some (sub)menu str = str .. "mouse over" self.showTimer = UIDROPDOWNMENU_SHOW_TIME -- reset timer - else -- mouse is elsewhere, decrease timer + else -- mouse is elsewhere, decrease timer str = str .. "count down" self.showTimer = self.showTimer - elapsed; end str = str - .." "..tostring(self.showTimer).."" - .." "..tostring(self.isCounting).."" ---[[ + .. " " .. tostring(self.showTimer) .. "" + .. " " .. tostring(self.isCounting) .. "" + --[[ if str == tstr then -- same, prevent run away text else @@ -118,16 +118,16 @@ local function StartCounting(self) if (self.parent) then StartCounting(self.parent) -- walk to top menu str = str .. "parent" --- elseif IsMouseOverMenu() then + -- elseif IsMouseOverMenu() then -- Mouse is in the menu --- str = str .. "over" + -- str = str .. "over" else str = str .. "start" -- allow time out self.showTimer = UIDROPDOWNMENU_SHOW_TIME; self.isCounting = 1; end ---[[ + --[[ print("TU _Leave Start" .." "..tostring(str).."" .." "..tostring(self:GetName()).."" @@ -144,15 +144,15 @@ local function StopCounting(frame) if (frame.parent) then str = str .. "parent" StopCounting(frame.parent) -- walk to top menu --- elseif IsMouseOverMenu() then --- str = str .. "stop" --- frame.isCounting = nil; + -- elseif IsMouseOverMenu() then + -- str = str .. "stop" + -- frame.isCounting = nil; -- Mouse is in the menu else str = str .. "nop" -- Nothing to do; if timing, allow to run out end ---[[ + --[[ print("TU _Enter Stop" .." "..tostring(str).."" .." "..tostring(frame:GetName()).."" @@ -166,7 +166,7 @@ end ---@param level number ---@param index number function TitanUtils_AddHide(level, index) ---[[ + --[[ print("TU _AddHide" .." "..tostring(level).."" .." "..tostring(index).."" @@ -203,13 +203,13 @@ print("TU _dd" end --]] -- In case any code creates more than 3. ----@diagnostic disable-next-line: param-type-mismatch + ---@diagnostic disable-next-line: param-type-mismatch if not AceHook:IsHooked("UIDropDownMenu_CreateFrames", TitanUtils_AddHide) then AceHook:SecureHook("UIDropDownMenu_CreateFrames", TitanUtils_AddHide) end -- This handles any level so hook it here ----@diagnostic disable-next-line: param-type-mismatch + ---@diagnostic disable-next-line: param-type-mismatch if not AceHook:IsHooked("UIDropDownMenu_OnUpdate", OnUpdateTimer) then AceHook:SecureHook("UIDropDownMenu_OnUpdate", OnUpdateTimer) end @@ -1279,7 +1279,7 @@ function TitanUtils_CashToString(value, thousands_separator, decimal_separator, if show_zero then copper_str = TitanUtils_GetHexText("0" .. c_lab, cc) --cc .. (amount or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE end - elseif amount > 999999999999999999 then -- 999,999,999,999,999,999 (1 quadrillion - 1) + elseif amount > 999999999999999999 then -- 999,999,999,999,999,999 (1 quadrillion - 1) -- we are really in trouble :) -- gold should be accurate but in exponent format gold = (math.floor(amount / agold) or 0) @@ -1965,11 +1965,11 @@ If someone where to start creating Titan frames after the registration process w notes = notes, } - Titan_Debug.Out('titan', 'plugin_register', "Queue Plugin" - -- .." '"..tostring(self:GetName()).."'" - .. " '" .. tostring(TitanUtils_GetButtonID(self:GetName())) .. "'" - .. " " .. tostring(TITAN_NOT_REGISTERED) .. "" - ) + Titan_Debug.Out('titan', 'plugin_register', "Queue Plugin" + -- .." '"..tostring(self:GetName()).."'" + .. " '" .. tostring(TitanUtils_GetButtonID(self:GetName())) .. "'" + .. " " .. tostring(TITAN_NOT_REGISTERED) .. "" + ) end ---local Handle a Titan plugin that could not be registered. @@ -2101,7 +2101,7 @@ NOTE: else -- We are almost done- TitanPanelButton_AddMouseScripts(self) ---[[ + --[[ -- Allow mouse clicks on the plugin local pluginID = TitanUtils_GetButtonID(self:GetName()); local plugin_id = TitanUtils_GetPlugin(pluginID); @@ -2146,13 +2146,13 @@ NOTE: issue = "Can not determine plugin button name" end - Titan_Debug.Out('titan', 'plugin_register', "Plugin RegProt" - -- .." '"..tostring(self:GetName()).."'" - .. " '" .. tostring(id) .. "'" - .. " '" .. tostring(result) .. "'" - .. " '" .. tostring(str) .. "'" - .. " '" .. tostring(TitanPlugins[id].id) .. "'" - ) + Titan_Debug.Out('titan', 'plugin_register', "Plugin RegProt" + -- .." '"..tostring(self:GetName()).."'" + .. " '" .. tostring(id) .. "'" + .. " '" .. tostring(result) .. "'" + .. " '" .. tostring(str) .. "'" + .. " '" .. tostring(TitanPlugins[id].id) .. "'" + ) -- create and return the results local ret_val = {} @@ -2218,10 +2218,10 @@ function TitanUtils_RegisterPlugin(plugin) , "error") end - Titan_Debug.Out('titan', 'plugin_register', "Registering Plugin" - .. " " .. tostring(plugin.name) .. "" - .. " " .. tostring(plugin.status) .. "" - ) + Titan_Debug.Out('titan', 'plugin_register', "Registering Plugin" + .. " " .. tostring(plugin.name) .. "" + .. " " .. tostring(plugin.status) .. "" + ) end end @@ -2337,11 +2337,11 @@ local function TitanRightClickMenu_OnLoad(self, menu) end end - if err == "" then - -- all is good - else - Titan_Debug.Out('titan', 'menu', "Error: "..err) - end + if err == "" then + -- all is good + else + Titan_Debug.Out('titan', 'menu', "Error: " .. err) + end -- Under the cover the menu is built as DropDownList1 -- return DropDownList1, DropDownList1:GetHeight(), DropDownList1:GetWidth() return menu, menu:GetHeight(), menu:GetWidth() @@ -2538,13 +2538,13 @@ end ---Check the given profile ensuring any profile pointed to exists ---@param profile string function TitanUtil_CheckProfile(profile) - local str = "_CheckProfile ["..tostring(profile).."]" + local str = "_CheckProfile [" .. tostring(profile) .. "]" local sync = TitanSettings.Players[profile].Panel["SyncWithProfile"] --- local play = TitanUtils_GetPlayer() + -- local play = TitanUtils_GetPlayer() -- see if sync is set - str = str.." s'"..sync.."'" + str = str .. " s'" .. sync .. "'" if (sync == Titan_Global.profile.NONE) then -- Nothing to do else @@ -2555,12 +2555,12 @@ function TitanUtil_CheckProfile(profile) TitanSettings.Players[profile].Panel["SyncWithProfile"] = Titan_Global.profile.NONE end end - str = str.." > '"..TitanSettings.Players[profile].Panel["SyncWithProfile"].."'" + str = str .. " > '" .. TitanSettings.Players[profile].Panel["SyncWithProfile"] .. "'" Titan_Debug.Out('titan', 'profile', str) end ----@class Get_Profile_Result +---@class Get_Profile_Result ---@field ptype string Type of profile being used ---@field pname string Name of profile being used ---@field cname string Name of profile being used color coded @@ -2598,10 +2598,10 @@ function TitanUtils_GetProfile(get_me) end local str = "_GetProfile" - .." "..tostring(ptype).."" - .." '"..tostring(cprofile).."'" - .." s'"..tostring(sync).."'" - .." t'"..tostring(play).."'" + .. " " .. tostring(ptype) .. "" + .. " '" .. tostring(cprofile) .. "'" + .. " s'" .. tostring(sync) .. "'" + .. " t'" .. tostring(play) .. "'" Titan_Debug.Out('titan', 'profile', str) res.ptype = ptype @@ -2617,9 +2617,9 @@ end ---@param to_profile string function TitanUtils_SetProfile(set_me, ptype, to_profile) local str = "_SetProfile" - .." ["..tostring(set_me).."]" - .." "..tostring(ptype).."" - .." to '"..tostring(to_profile).."'" + .. " [" .. tostring(set_me) .. "]" + .. " " .. tostring(ptype) .. "" + .. " to '" .. tostring(to_profile) .. "'" Titan_Debug.Out('titan', 'profile', str) if ptype == Titan_Global.profile.SYNC then @@ -2629,6 +2629,118 @@ function TitanUtils_SetProfile(set_me, ptype, to_profile) end end +local function TrimString(string) + local from = string:match "^%s*()" + return from > #string and "" or string:match(".*%S", from) +end + +local function CopyToCompress(t1, t2) + for key, value in pairs(t2) do + if (key ~= "__index" and type(value) ~= "function") then + if (type(value) == "table") then + if (not value.GetObjectType) then + t1[key] = t1[key] or {} + CopyToCompress(t1[key], t2[key]) + end + else + t1[key] = value + end + end + end + return t1 +end + +---Compress and serialize arbitrary data into a string +---@param data any +---@param dataType string print | comm +---@return string compressed could be "" +function TitanUtils_CompressData(data, dataType) + local LibDeflate = LibStub:GetLibrary("LibDeflate") + local LibAceSerializer = LibStub:GetLibrary("AceSerializer-3.0") + + --check if there isn't funtions in the data to export + local dataCopied = CopyToCompress({}, data) + + if (LibDeflate and LibAceSerializer) then + local dataSerialized = LibAceSerializer:Serialize(dataCopied) + if (dataSerialized) then + local dataCompressed = LibDeflate:CompressDeflate(dataSerialized, { level = 9 }) + if (dataCompressed) then + if (dataType == "print") then + local dataEncoded = LibDeflate:EncodeForPrint(dataCompressed) + return dataEncoded + elseif (dataType == "comm") then + local dataEncoded = LibDeflate:EncodeForWoWAddonChannel(dataCompressed) + return dataEncoded + end + end + end + end + + return "" +end + +---Decompress and unserialize a string into the Lua data it represents +---@param data any +---@param dataType string print | comm +---@return boolean +---@return table +function TitanUtils_DecompressData(data, dataType) + local LibDeflate = LibStub:GetLibrary("LibDeflate") + local LibAceSerializer = LibStub:GetLibrary("AceSerializer-3.0") + + if (LibDeflate and LibAceSerializer) then + local dataCompressed + + if (dataType == "print") then + data = TrimString(data) + dataCompressed = LibDeflate:DecodeForPrint(data) + if (not dataCompressed) then + TitanPrint("Could not decode the data.", "warning") + return false, {} + end + elseif (dataType == "comm") then + dataCompressed = LibDeflate:DecodeForWoWAddonChannel(data) + if (not dataCompressed) then + TitanPrint("Could not decode the data.", "warning") + return false, {} + end + end + + local dataSerialized = LibDeflate:DecompressDeflate(dataCompressed) + if (not dataSerialized) then + TitanPrint("Could not uncompress the data.", "warning") + return false, {} + end + + local okay, out_data = LibAceSerializer:Deserialize(dataSerialized) + if (not okay) then + TitanPrint("Could not unserialize the data.", "warning") + return false, {} + end + + return true, out_data + end + return false, {} +end + +--[==[ + +local profile = TitanSettings.Players["Nycti@Staghelm"] --TitanSettings + +local out = CompressData(profile, "print") +print("====") +print(string.len(out)) +print(tostring(out)) +print("------") + +local in_p = DecompressData(out, "print") + +print(tostring(in_p)) +TitanDumpTable(in_p) +print("====") +--]==] + -------------------------------------------------------------- -- Various debug routines --[[ @@ -2817,18 +2929,18 @@ end ---@param tb table ---@param level integer? 1 or defaults to 1 function TitanDumpTable(tb, level) - level = level or 1 - local spaces = string.rep(' ', level) - for k, v in pairs(tb) do - if type(v) == "table" then - print("[" .. level .. "]" .. spaces .. "[" .. tostring(k) .. "]" .. " "..type(v)) - if level <= 8 then - TitanDumpTable(v, level+1) - end - else - print("[" .. level .. "]" ..spaces .. "[" .. tostring(k) .. "]='" .. tostring(v) .. "' "..type(v)) - end - end + level = level or 1 + local spaces = string.rep(' ', level) + for k, v in pairs(tb) do + if type(v) == "table" then + print("[" .. level .. "]" .. spaces .. "[" .. tostring(k) .. "]" .. " " .. type(v)) + if level <= 8 then + TitanDumpTable(v, level + 1) + end + else + print("[" .. level .. "]" .. spaces .. "[" .. tostring(k) .. "]='" .. tostring(v) .. "' " .. type(v)) + end + end end ---Titan: From a given table; find input in its indexes. diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index 15d04f7..0cd7c74 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -1052,6 +1052,107 @@ local function Check_toon_settings(toon, toon_table) -- Toon is now ready to accept profile values end +---Create an export string form a list of toons and whether to include Titan saved vars +---@param export table +---@param titan_all boolean +---@return string export string +function TitanVariables_CreateExport(export, titan_all) + local res = "" + local str = "" + local new_ex = + { + version = 1, + addon = "Titan_export", + titan_all = false, + toons = {}, -- list of toons exported + } + + str = "_CreateExport" + .." ".. tostring(export) .. "" + .." ".. tostring(titan_all) .. "" + Titan_Debug.Out('titan', 'profile', "_CreateExport") + + str = "... loop "..type(export).."\n" + if type(export) == 'table' then + for index, val in pairs(export) do + local added = false + str = str .."... toon".. " '" .. tostring(index) .. "'" + if val then + str = str.." include" + if TitanSettings.Players[index] then + new_ex.toons[index] = TitanSettings.Players[index] + added = true + else + -- no player? + added = false + end + str = str .. " + " .. tostring(added) .. "" + else + str = str.." exclude" + end + str = str.." \n" + end + else + -- something + str = str.."not table?? \n" + end + Titan_Debug.Out('titan', 'profile', str) + + res = TitanUtils_CompressData(new_ex, "print") + + str = "... result length ".. string.len(res).." bytes" + Titan_Debug.Out('titan', 'profile', str) + Titan_Debug.Out('titan', 'profile', "_CreateExport fini") + + return res +end + +function TitanVariables_ProcessImport(import) + local res = false + local str = "" + local new_im = {} + local ok = false + + str = "_ProcessImport" + .." ".. type(import) .. "" + .." ".. string.len(import) .. "" + Titan_Debug.Out('titan', 'profile', "_CreateExport") + + str = "... loop ".."\n" + if type(import) == 'string' then + -- decompress and make into a table... + ok, new_im = TitanUtils_DecompressData(import, "print") + + if ok then + -- process any toons found by putting them into TitanSettings.Players + for index, val in pairs(new_im.toons) do + str = str .."... toon".. " '" .. tostring(index) .. "'" + if TitanSettings.Players[index] then + TitanSettings.Players[index] = nil -- likely not needed but safe + else + -- just add below + end + TitanSettings.Players[index] = val + str = str.." \n" + end + res = true -- all should be ok... + else + -- The decompress should have output an err... + end + else + -- something + str = str.."not string?? \n" + end + Titan_Debug.Out('titan', 'profile', str) + + Titan_Debug.Out('titan', 'profile', "_ProcessImport fini") + + return res +end + +function TitanVariables_ProcessExport(export) +end + ---Titan Ensure TitanSettings (one of the saved vars in the toc) exists and set the Titan version. --- Called early when processing PLAYER_ENTERING_WORLD event) function TitanVariables_InitTitanSettings() @@ -1285,7 +1386,8 @@ local function Init_player_settings(from_profile, to_profile, action) Set_Timers(reset) -- for debug if a user needs to send in the Titan saved vars - TitanPanelRegister = TitanPlayerSettings["Register"] +-- TitanPanelRegister = TitanPlayerSettings["Register"] + TitanPlayerSettings["Register"] = nil end ---API Get the value of the requested plugin variable. diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets.toc b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets.toc deleted file mode 100644 index 23abaca..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets.toc +++ /dev/null @@ -1,16 +0,0 @@ -## Interface: 90001 - -## Title: Lib: AceGUI-3.0-SharedMediaWidgets -## Notes: Enables AceGUI-3.0 widgets for the 5 basic SharedMedia-3.0 types -## Author: Yssaril -## OptionalDeps: Ace3, LibSharedMedia-3.0 -## X-Category: Library - -#@no-lib-strip@ -Libs\Libstub\Libstub.lua -Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml -Libs\AceGUI-3.0\AceGUI-3.0.xml -Libs\LibSharedMedia-3.0\lib.xml -#@end-no-lib-strip@ - -widget.xml diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BackgroundWidget.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BackgroundWidget.lua deleted file mode 100644 index 19ad608..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BackgroundWidget.lua +++ /dev/null @@ -1,235 +0,0 @@ --- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 --- Widget created by Yssaril - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") - -do - local widgetType = "LSM30_Background" - local widgetVersion = 13 - - local contentFrameCache = {} - local function ReturnSelf(self) - self:ClearAllPoints() - self:Hide() - self.check:Hide() - table.insert(contentFrameCache, self) - end - - local function ContentOnClick(this, button) - local self = this.obj - self:Fire("OnValueChanged", this.text:GetText()) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function ContentOnEnter(this, button) - local self = this.obj - local text = this.text:GetText() - local background = self.list[text] ~= text and self.list[text] or Media:Fetch('background',text) - self.dropdown.bgTex:SetTexture(background) - end - - local function GetContentLine() - local frame - if next(contentFrameCache) then - frame = table.remove(contentFrameCache) - else - frame = CreateFrame("Button", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate") - --frame:SetWidth(200) - frame:SetHeight(18) - frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") - frame:SetScript("OnClick", ContentOnClick) - frame:SetScript("OnEnter", ContentOnEnter) - - local check = frame:CreateTexture("OVERLAY") - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint("LEFT",frame,"LEFT",1,-1) - check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") - check:Hide() - frame.check = check - - local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") - local font, size = text:GetFont() - text:SetFont(font,size,"OUTLINE") - - text:SetPoint("TOPLEFT", check, "TOPRIGHT", 1, 0) - text:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 0) - text:SetJustifyH("LEFT") - text:SetText("Test Test Test Test Test Test Test") - frame.text = text - - frame.ReturnSelf = ReturnSelf - end - frame:Show() - return frame - end - - local function OnAcquire(self) - self:SetHeight(44) - self:SetWidth(200) - end - - local function OnRelease(self) - self:SetText("") - self:SetLabel("") - self:SetDisabled(false) - - self.value = nil - self.list = nil - self.open = nil - self.hasClose = nil - - self.frame:ClearAllPoints() - self.frame:Hide() - end - - local function SetValue(self, value) -- Set the value to an item in the List. - if self.list then - self:SetText(value or "") - end - self.value = value - end - - local function GetValue(self) - return self.value - end - - local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) - self.list = list or Media:HashTable("background") - end - - - local function SetText(self, text) -- Set the text displayed in the box. - self.frame.text:SetText(text or "") - local background = self.list[text] ~= text and self.list[text] or Media:Fetch('background',text) - - self.frame.displayButton:SetBackdrop({bgFile = background, - edgeFile = "Interface/Tooltips/UI-Tooltip-Border", - edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 }}) - end - - local function SetLabel(self, text) -- Set the text for the label. - self.frame.label:SetText(text or "") - end - - local function AddItem(self, key, value) -- Add an item to the list. - self.list = self.list or {} - self.list[key] = value - end - local SetItemValue = AddItem -- Set the value of a item in the list. <> - - local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> - local function GetMultiselect() return false end-- Query the multi-select flag. <> - local function SetItemDisabled(self, key) end-- Disable one item in the list. <> - - local function SetDisabled(self, disabled) -- Disable the widget. - self.disabled = disabled - if disabled then - self.frame:Disable() - self.frame.displayButton:SetBackdropColor(.2,.2,.2,1) - else - self.frame:Enable() - self.frame.displayButton:SetBackdropColor(1,1,1,1) - end - end - - local function textSort(a,b) - return string.upper(a) < string.upper(b) - end - - local sortedlist = {} - local function ToggleDrop(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - AceGUI:ClearFocus() - else - AceGUI:SetFocus(self) - self.dropdown = AGSMW:GetDropDownFrame() - local width = self.frame:GetWidth() - self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) - for k, v in pairs(self.list) do - sortedlist[#sortedlist+1] = k - end - table.sort(sortedlist, textSort) - for i, k in ipairs(sortedlist) do - local f = GetContentLine() - f.text:SetText(k) - --print(k) - if k == self.value then - f.check:Show() - end - f.obj = self - f.dropdown = self.dropdown - self.dropdown:AddFrame(f) - end - wipe(sortedlist) - end - end - - local function ClearFocus(self) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function OnHide(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function Drop_OnEnter(this) - this.obj:Fire("OnEnter") - end - - local function Drop_OnLeave(this) - this.obj:Fire("OnLeave") - end - - local function Constructor() - local frame = AGSMW:GetBaseFrameWithWindow() - local self = {} - - self.type = widgetType - self.frame = frame - frame.obj = self - frame.dropButton.obj = self - frame.dropButton:SetScript("OnEnter", Drop_OnEnter) - frame.dropButton:SetScript("OnLeave", Drop_OnLeave) - frame.dropButton:SetScript("OnClick",ToggleDrop) - frame:SetScript("OnHide", OnHide) - - self.alignoffset = 31 - - self.OnRelease = OnRelease - self.OnAcquire = OnAcquire - self.ClearFocus = ClearFocus - self.SetText = SetText - self.SetValue = SetValue - self.GetValue = GetValue - self.SetList = SetList - self.SetLabel = SetLabel - self.SetDisabled = SetDisabled - self.AddItem = AddItem - self.SetMultiselect = SetMultiselect - self.GetMultiselect = GetMultiselect - self.SetItemValue = SetItemValue - self.SetItemDisabled = SetItemDisabled - self.ToggleDrop = ToggleDrop - - AceGUI:RegisterAsWidget(self) - return self - end - - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) - -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua deleted file mode 100644 index 0f2cbea..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua +++ /dev/null @@ -1,230 +0,0 @@ --- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 --- Widget created by Yssaril - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") - -do - local widgetType = "LSM30_Border" - local widgetVersion = 13 - - local contentFrameCache = {} - local function ReturnSelf(self) - self:ClearAllPoints() - self:Hide() - self.check:Hide() - table.insert(contentFrameCache, self) - end - - local function ContentOnClick(this, button) - local self = this.obj - self:Fire("OnValueChanged", this.text:GetText()) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function ContentOnEnter(this, button) - local self = this.obj - local text = this.text:GetText() - local border = self.list[text] ~= text and self.list[text] or Media:Fetch('border',text) - this.dropdown:SetBackdrop({edgeFile = border, - bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 }}) - end - - local function GetContentLine() - local frame - if next(contentFrameCache) then - frame = table.remove(contentFrameCache) - else - frame = CreateFrame("Button", nil, UIParent) - --frame:SetWidth(200) - frame:SetHeight(18) - frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") - frame:SetScript("OnClick", ContentOnClick) - frame:SetScript("OnEnter", ContentOnEnter) - local check = frame:CreateTexture("OVERLAY") - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint("LEFT",frame,"LEFT",1,-1) - check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") - check:Hide() - frame.check = check - local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") - text:SetPoint("TOPLEFT", check, "TOPRIGHT", 1, 0) - text:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 0) - text:SetJustifyH("LEFT") - text:SetText("Test Test Test Test Test Test Test") - frame.text = text - frame.ReturnSelf = ReturnSelf - end - frame:Show() - return frame - end - - local function OnAcquire(self) - self:SetHeight(44) - self:SetWidth(200) - end - - local function OnRelease(self) - self:SetText("") - self:SetLabel("") - self:SetDisabled(false) - - self.value = nil - self.list = nil - self.open = nil - self.hasClose = nil - - self.frame:ClearAllPoints() - self.frame:Hide() - end - - local function SetValue(self, value) -- Set the value to an item in the List. - if self.list then - self:SetText(value or "") - end - self.value = value - end - - local function GetValue(self) - return self.value - end - - local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) - self.list = list or Media:HashTable("border") - end - - - local function SetText(self, text) -- Set the text displayed in the box. - self.frame.text:SetText(text or "") - local border = self.list[text] ~= text and self.list[text] or Media:Fetch('border',text) - - self.frame.displayButton:SetBackdrop({edgeFile = border, - bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 }}) - end - - local function SetLabel(self, text) -- Set the text for the label. - self.frame.label:SetText(text or "") - end - - local function AddItem(self, key, value) -- Add an item to the list. - self.list = self.list or {} - self.list[key] = value - end - local SetItemValue = AddItem -- Set the value of a item in the list. <> - - local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> - local function GetMultiselect() return false end-- Query the multi-select flag. <> - local function SetItemDisabled(self, key) end-- Disable one item in the list. <> - - local function SetDisabled(self, disabled) -- Disable the widget. - self.disabled = disabled - if disabled then - self.frame:Disable() - else - self.frame:Enable() - end - end - - local function textSort(a,b) - return string.upper(a) < string.upper(b) - end - - local sortedlist = {} - local function ToggleDrop(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - AceGUI:ClearFocus() - else - AceGUI:SetFocus(self) - self.dropdown = AGSMW:GetDropDownFrame() - local width = self.frame:GetWidth() - self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) - for k, v in pairs(self.list) do - sortedlist[#sortedlist+1] = k - end - table.sort(sortedlist, textSort) - for i, k in ipairs(sortedlist) do - local f = GetContentLine() - f.text:SetText(k) - --print(k) - if k == self.value then - f.check:Show() - end - f.obj = self - f.dropdown = self.dropdown - self.dropdown:AddFrame(f) - end - wipe(sortedlist) - end - end - - local function ClearFocus(self) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function OnHide(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function Drop_OnEnter(this) - this.obj:Fire("OnEnter") - end - - local function Drop_OnLeave(this) - this.obj:Fire("OnLeave") - end - - local function Constructor() - local frame = AGSMW:GetBaseFrameWithWindow() - local self = {} - - self.type = widgetType - self.frame = frame - frame.obj = self - frame.dropButton.obj = self - frame.dropButton:SetScript("OnEnter", Drop_OnEnter) - frame.dropButton:SetScript("OnLeave", Drop_OnLeave) - frame.dropButton:SetScript("OnClick",ToggleDrop) - frame:SetScript("OnHide", OnHide) - - self.alignoffset = 31 - - self.OnRelease = OnRelease - self.OnAcquire = OnAcquire - self.ClearFocus = ClearFocus - self.SetText = SetText - self.SetValue = SetValue - self.GetValue = GetValue - self.SetList = SetList - self.SetLabel = SetLabel - self.SetDisabled = SetDisabled - self.AddItem = AddItem - self.SetMultiselect = SetMultiselect - self.GetMultiselect = GetMultiselect - self.SetItemValue = SetItemValue - self.SetItemDisabled = SetItemDisabled - self.ToggleDrop = ToggleDrop - - AceGUI:RegisterAsWidget(self) - return self - end - - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) - -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/FontWidget.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/FontWidget.lua deleted file mode 100644 index e9f98b9..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/FontWidget.lua +++ /dev/null @@ -1,216 +0,0 @@ --- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 --- Widget created by Yssaril - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") - -do - local widgetType = "LSM30_Font" - local widgetVersion = 13 - - local contentFrameCache = {} - local function ReturnSelf(self) - self:ClearAllPoints() - self:Hide() - self.check:Hide() - table.insert(contentFrameCache, self) - end - - local function ContentOnClick(this, button) - local self = this.obj - self:Fire("OnValueChanged", this.text:GetText()) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function GetContentLine() - local frame - if next(contentFrameCache) then - frame = table.remove(contentFrameCache) - else - frame = CreateFrame("Button", nil, UIParent) - --frame:SetWidth(200) - frame:SetHeight(18) - frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") - frame:SetScript("OnClick", ContentOnClick) - local check = frame:CreateTexture("OVERLAY") - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint("LEFT",frame,"LEFT",1,-1) - check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") - check:Hide() - frame.check = check - local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") - text:SetPoint("TOPLEFT", check, "TOPRIGHT", 1, 0) - text:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 0) - text:SetJustifyH("LEFT") - text:SetText("Test Test Test Test Test Test Test") - frame.text = text - frame.ReturnSelf = ReturnSelf - end - frame:Show() - return frame - end - - local function OnAcquire(self) - self:SetHeight(44) - self:SetWidth(200) - end - - local function OnRelease(self) - self:SetText("") - self:SetLabel("") - self:SetDisabled(false) - - self.value = nil - self.list = nil - self.open = nil - self.hasClose = nil - - self.frame:ClearAllPoints() - self.frame:Hide() - end - - local function SetValue(self, value) -- Set the value to an item in the List. - if self.list then - self:SetText(value or "") - end - self.value = value - end - - local function GetValue(self) - return self.value - end - - local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) - self.list = list or Media:HashTable("font") - end - - local function SetText(self, text) -- Set the text displayed in the box. - self.frame.text:SetText(text or "") - local font = self.list[text] ~= text and self.list[text] or Media:Fetch('font',text) - local _, size, outline= self.frame.text:GetFont() - self.frame.text:SetFont(font,size,outline) - end - - local function SetLabel(self, text) -- Set the text for the label. - self.frame.label:SetText(text or "") - end - - local function AddItem(self, key, value) -- Add an item to the list. - self.list = self.list or {} - self.list[key] = value - end - local SetItemValue = AddItem -- Set the value of a item in the list. <> - - local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> - local function GetMultiselect() return false end-- Query the multi-select flag. <> - local function SetItemDisabled(self, key) end-- Disable one item in the list. <> - - local function SetDisabled(self, disabled) -- Disable the widget. - self.disabled = disabled - if disabled then - self.frame:Disable() - else - self.frame:Enable() - end - end - - local function textSort(a,b) - return string.upper(a) < string.upper(b) - end - - local sortedlist = {} - local function ToggleDrop(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - AceGUI:ClearFocus() - else - AceGUI:SetFocus(self) - self.dropdown = AGSMW:GetDropDownFrame() - local width = self.frame:GetWidth() - self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) - for k, v in pairs(self.list) do - sortedlist[#sortedlist+1] = k - end - table.sort(sortedlist, textSort) - for i, k in ipairs(sortedlist) do - local f = GetContentLine() - local _, size, outline= f.text:GetFont() - local font = self.list[k] ~= k and self.list[k] or Media:Fetch('font',k) - f.text:SetFont(font,size,outline) - f.text:SetText(k) - if k == self.value then - f.check:Show() - end - f.obj = self - self.dropdown:AddFrame(f) - end - wipe(sortedlist) - end - end - - local function ClearFocus(self) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function OnHide(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function Drop_OnEnter(this) - this.obj:Fire("OnEnter") - end - - local function Drop_OnLeave(this) - this.obj:Fire("OnLeave") - end - - local function Constructor() - local frame = AGSMW:GetBaseFrame() - local self = {} - - self.type = widgetType - self.frame = frame - frame.obj = self - frame.dropButton.obj = self - frame.dropButton:SetScript("OnEnter", Drop_OnEnter) - frame.dropButton:SetScript("OnLeave", Drop_OnLeave) - frame.dropButton:SetScript("OnClick",ToggleDrop) - frame:SetScript("OnHide", OnHide) - - self.alignoffset = 31 - - self.OnRelease = OnRelease - self.OnAcquire = OnAcquire - self.ClearFocus = ClearFocus - self.SetText = SetText - self.SetValue = SetValue - self.GetValue = GetValue - self.SetList = SetList - self.SetLabel = SetLabel - self.SetDisabled = SetDisabled - self.AddItem = AddItem - self.SetMultiselect = SetMultiselect - self.GetMultiselect = GetMultiselect - self.SetItemValue = SetItemValue - self.SetItemDisabled = SetItemDisabled - self.ToggleDrop = ToggleDrop - - AceGUI:RegisterAsWidget(self) - return self - end - - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) - -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua deleted file mode 100644 index 77557a5..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua +++ /dev/null @@ -1,264 +0,0 @@ --- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 --- Widget created by Yssaril - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") - -do - local widgetType = "LSM30_Sound" - local widgetVersion = 13 - - local contentFrameCache = {} - local function ReturnSelf(self) - self:ClearAllPoints() - self:Hide() - self.check:Hide() - table.insert(contentFrameCache, self) - end - - local function ContentOnClick(this, button) - local self = this.obj - self:Fire("OnValueChanged", this.text:GetText()) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function ContentSpeakerOnClick(this, button) - local self = this.frame.obj - local sound = this.frame.text:GetText() - PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound), "Master") - end - - local function GetContentLine() - local frame - if next(contentFrameCache) then - frame = table.remove(contentFrameCache) - else - frame = CreateFrame("Button", nil, UIParent) - --frame:SetWidth(200) - frame:SetHeight(18) - frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") - frame:SetScript("OnClick", ContentOnClick) - local check = frame:CreateTexture("OVERLAY") - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint("LEFT",frame,"LEFT",1,-1) - check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") - check:Hide() - frame.check = check - - local soundbutton = CreateFrame("Button", nil, frame) - soundbutton:SetWidth(16) - soundbutton:SetHeight(16) - soundbutton:SetPoint("RIGHT",frame,"RIGHT",-1,0) - soundbutton.frame = frame - soundbutton:SetScript("OnClick", ContentSpeakerOnClick) - frame.soundbutton = soundbutton - - local speaker = soundbutton:CreateTexture(nil, "BACKGROUND") - speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") - speaker:SetAllPoints(soundbutton) - frame.speaker = speaker - local speakeron = soundbutton:CreateTexture(nil, "HIGHLIGHT") - speakeron:SetTexture("Interface\\Common\\VoiceChat-On") - speakeron:SetAllPoints(soundbutton) - frame.speakeron = speakeron - - local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") - text:SetPoint("TOPLEFT", check, "TOPRIGHT", 1, 0) - text:SetPoint("BOTTOMRIGHT", soundbutton, "BOTTOMLEFT", -2, 0) - text:SetJustifyH("LEFT") - text:SetText("Test Test Test Test Test Test Test") - frame.text = text - frame.ReturnSelf = ReturnSelf - end - frame:Show() - return frame - end - - local function OnAcquire(self) - self:SetHeight(44) - self:SetWidth(200) - end - - local function OnRelease(self) - self:SetText("") - self:SetLabel("") - self:SetDisabled(false) - - self.value = nil - self.list = nil - self.open = nil - self.hasClose = nil - - self.frame:ClearAllPoints() - self.frame:Hide() - end - - local function SetValue(self, value) -- Set the value to an item in the List. - if self.list then - self:SetText(value or "") - end - self.value = value - end - - local function GetValue(self) - return self.value - end - - local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) - self.list = list or Media:HashTable("sound") - end - - local function SetText(self, text) -- Set the text displayed in the box. - self.frame.text:SetText(text or "") - end - - local function SetLabel(self, text) -- Set the text for the label. - self.frame.label:SetText(text or "") - end - - local function AddItem(self, key, value) -- Add an item to the list. - self.list = self.list or {} - self.list[key] = value - end - local SetItemValue = AddItem -- Set the value of a item in the list. <> - - local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> - local function GetMultiselect() return false end-- Query the multi-select flag. <> - local function SetItemDisabled(self, key) end-- Disable one item in the list. <> - - local function SetDisabled(self, disabled) -- Disable the widget. - self.disabled = disabled - if disabled then - self.frame:Disable() - self.speaker:SetDesaturated(true) - self.speakeron:SetDesaturated(true) - else - self.frame:Enable() - self.speaker:SetDesaturated(false) - self.speakeron:SetDesaturated(false) - end - end - - local function textSort(a,b) - return string.upper(a) < string.upper(b) - end - - local sortedlist = {} - local function ToggleDrop(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - AceGUI:ClearFocus() - else - AceGUI:SetFocus(self) - self.dropdown = AGSMW:GetDropDownFrame() - local width = self.frame:GetWidth() - self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) - for k, v in pairs(self.list) do - sortedlist[#sortedlist+1] = k - end - table.sort(sortedlist, textSort) - for i, k in ipairs(sortedlist) do - local f = GetContentLine() - f.text:SetText(k) - if k == self.value then - f.check:Show() - end - f.obj = self - self.dropdown:AddFrame(f) - end - wipe(sortedlist) - end - end - - local function ClearFocus(self) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function OnHide(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function Drop_OnEnter(this) - this.obj:Fire("OnEnter") - end - - local function Drop_OnLeave(this) - this.obj:Fire("OnLeave") - end - - local function WidgetPlaySound(this) - local self = this.obj - local sound = self.frame.text:GetText() - PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound), "Master") - end - - local function Constructor() - local frame = AGSMW:GetBaseFrame() - local self = {} - - self.type = widgetType - self.frame = frame - frame.obj = self - frame.dropButton.obj = self - frame.dropButton:SetScript("OnEnter", Drop_OnEnter) - frame.dropButton:SetScript("OnLeave", Drop_OnLeave) - frame.dropButton:SetScript("OnClick",ToggleDrop) - frame:SetScript("OnHide", OnHide) - - - local soundbutton = CreateFrame("Button", nil, frame) - soundbutton:SetWidth(16) - soundbutton:SetHeight(16) - soundbutton:SetPoint("LEFT",frame.DLeft,"LEFT",26,1) - soundbutton:SetScript("OnClick", WidgetPlaySound) - soundbutton.obj = self - self.soundbutton = soundbutton - frame.text:SetPoint("LEFT",soundbutton,"RIGHT",2,0) - - - local speaker = soundbutton:CreateTexture(nil, "BACKGROUND") - speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") - speaker:SetAllPoints(soundbutton) - self.speaker = speaker - local speakeron = soundbutton:CreateTexture(nil, "HIGHLIGHT") - speakeron:SetTexture("Interface\\Common\\VoiceChat-On") - speakeron:SetAllPoints(soundbutton) - self.speakeron = speakeron - - self.alignoffset = 31 - - self.OnRelease = OnRelease - self.OnAcquire = OnAcquire - self.ClearFocus = ClearFocus - self.SetText = SetText - self.SetValue = SetValue - self.GetValue = GetValue - self.SetList = SetList - self.SetLabel = SetLabel - self.SetDisabled = SetDisabled - self.AddItem = AddItem - self.SetMultiselect = SetMultiselect - self.GetMultiselect = GetMultiselect - self.SetItemValue = SetItemValue - self.SetItemDisabled = SetItemDisabled - self.ToggleDrop = ToggleDrop - - AceGUI:RegisterAsWidget(self) - return self - end - - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) - -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/StatusbarWidget.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/StatusbarWidget.lua deleted file mode 100644 index 05467aa..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/StatusbarWidget.lua +++ /dev/null @@ -1,233 +0,0 @@ --- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 --- Widget created by Yssaril - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") - -do - local widgetType = "LSM30_Statusbar" - local widgetVersion = 13 - - local contentFrameCache = {} - local function ReturnSelf(self) - self:ClearAllPoints() - self:Hide() - self.check:Hide() - table.insert(contentFrameCache, self) - end - - local function ContentOnClick(this, button) - local self = this.obj - self:Fire("OnValueChanged", this.text:GetText()) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function GetContentLine() - local frame - if next(contentFrameCache) then - frame = table.remove(contentFrameCache) - else - frame = CreateFrame("Button", nil, UIParent) - --frame:SetWidth(200) - frame:SetHeight(18) - frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") - frame:SetScript("OnClick", ContentOnClick) - local check = frame:CreateTexture("OVERLAY") - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint("LEFT",frame,"LEFT",1,-1) - check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") - check:Hide() - frame.check = check - local bar = frame:CreateTexture("ARTWORK") - bar:SetHeight(16) - bar:SetPoint("LEFT",check,"RIGHT",1,0) - bar:SetPoint("RIGHT",frame,"RIGHT",-1,0) - frame.bar = bar - local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") - - local font, size = text:GetFont() - text:SetFont(font,size,"OUTLINE") - - text:SetPoint("TOPLEFT", check, "TOPRIGHT", 3, 0) - text:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 0) - text:SetJustifyH("LEFT") - text:SetText("Test Test Test Test Test Test Test") - frame.text = text - frame.ReturnSelf = ReturnSelf - end - frame:Show() - return frame - end - - local function OnAcquire(self) - self:SetHeight(44) - self:SetWidth(200) - end - - local function OnRelease(self) - self:SetText("") - self:SetLabel("") - self:SetDisabled(false) - - self.value = nil - self.list = nil - self.open = nil - self.hasClose = nil - - self.frame:ClearAllPoints() - self.frame:Hide() - end - - local function SetValue(self, value) -- Set the value to an item in the List. - if self.list then - self:SetText(value or "") - end - self.value = value - end - - local function GetValue(self) - return self.value - end - - local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) - self.list = list or Media:HashTable("statusbar") - end - - - local function SetText(self, text) -- Set the text displayed in the box. - self.frame.text:SetText(text or "") - local statusbar = self.list[text] ~= text and self.list[text] or Media:Fetch('statusbar',text) - self.bar:SetTexture(statusbar) - end - - local function SetLabel(self, text) -- Set the text for the label. - self.frame.label:SetText(text or "") - end - - local function AddItem(self, key, value) -- Add an item to the list. - self.list = self.list or {} - self.list[key] = value - end - local SetItemValue = AddItem -- Set the value of a item in the list. <> - - local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> - local function GetMultiselect() return false end-- Query the multi-select flag. <> - local function SetItemDisabled(self, key) end-- Disable one item in the list. <> - - local function SetDisabled(self, disabled) -- Disable the widget. - self.disabled = disabled - if disabled then - self.frame:Disable() - else - self.frame:Enable() - end - end - - local function textSort(a,b) - return string.upper(a) < string.upper(b) - end - - local sortedlist = {} - local function ToggleDrop(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - AceGUI:ClearFocus() - else - AceGUI:SetFocus(self) - self.dropdown = AGSMW:GetDropDownFrame() - local width = self.frame:GetWidth() - self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") - self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0) - for k, v in pairs(self.list) do - sortedlist[#sortedlist+1] = k - end - table.sort(sortedlist, textSort) - for i, k in ipairs(sortedlist) do - local f = GetContentLine() - f.text:SetText(k) - --print(k) - if k == self.value then - f.check:Show() - end - - local statusbar = self.list[k] ~= k and self.list[k] or Media:Fetch('statusbar',k) - f.bar:SetTexture(statusbar) - f.obj = self - f.dropdown = self.dropdown - self.dropdown:AddFrame(f) - end - wipe(sortedlist) - end - end - - local function ClearFocus(self) - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function OnHide(this) - local self = this.obj - if self.dropdown then - self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) - end - end - - local function Drop_OnEnter(this) - this.obj:Fire("OnEnter") - end - - local function Drop_OnLeave(this) - this.obj:Fire("OnLeave") - end - - local function Constructor() - local frame = AGSMW:GetBaseFrame() - local self = {} - - self.type = widgetType - self.frame = frame - frame.obj = self - frame.dropButton.obj = self - frame.dropButton:SetScript("OnEnter", Drop_OnEnter) - frame.dropButton:SetScript("OnLeave", Drop_OnLeave) - frame.dropButton:SetScript("OnClick",ToggleDrop) - frame:SetScript("OnHide", OnHide) - - local bar = frame:CreateTexture(nil, "OVERLAY") - bar:SetPoint("TOPLEFT", frame,"TOPLEFT",6,-25) - bar:SetPoint("BOTTOMRIGHT", frame,"BOTTOMRIGHT", -21, 5) - bar:SetAlpha(0.5) - self.bar = bar - - self.alignoffset = 31 - - self.OnRelease = OnRelease - self.OnAcquire = OnAcquire - self.ClearFocus = ClearFocus - self.SetText = SetText - self.SetValue = SetValue - self.GetValue = GetValue - self.SetList = SetList - self.SetLabel = SetLabel - self.SetDisabled = SetDisabled - self.AddItem = AddItem - self.SetMultiselect = SetMultiselect - self.GetMultiselect = GetMultiselect - self.SetItemValue = SetItemValue - self.SetItemDisabled = SetItemDisabled - self.ToggleDrop = ToggleDrop - - AceGUI:RegisterAsWidget(self) - return self - end - - AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) - -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/prototypes.lua b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/prototypes.lua deleted file mode 100644 index 95b511d..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/prototypes.lua +++ /dev/null @@ -1,266 +0,0 @@ --- Widget created by Yssaril -local DataVersion = 9004 -local AGSMW = LibStub:NewLibrary("AceGUISharedMediaWidgets-1.0", DataVersion) - -if not AGSMW then - return -- already loaded and no upgrade necessary -end - -local AceGUI = LibStub("AceGUI-3.0") -local Media = LibStub("LibSharedMedia-3.0") - -AGSMW = AGSMW or {} - -AceGUIWidgetLSMlists = { - ['font'] = Media:HashTable("font"), - ['sound'] = Media:HashTable("sound"), - ['statusbar'] = Media:HashTable("statusbar"), - ['border'] = Media:HashTable("border"), - ['background'] = Media:HashTable("background"), -} - -do - local function disable(frame) - frame.label:SetTextColor(.5,.5,.5) - frame.text:SetTextColor(.5,.5,.5) - frame.dropButton:Disable() - if frame.displayButtonFont then - frame.displayButtonFont:SetTextColor(.5,.5,.5) - frame.displayButton:Disable() - end - end - - local function enable(frame) - frame.label:SetTextColor(1,.82,0) - frame.text:SetTextColor(1,1,1) - frame.dropButton:Enable() - if frame.displayButtonFont then - frame.displayButtonFont:SetTextColor(1,1,1) - frame.displayButton:Enable() - end - end - - local displayButtonBackdrop = { - edgeFile = "Interface/Tooltips/UI-Tooltip-Border", - tile = true, tileSize = 16, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 }, - } - - -- create or retrieve BaseFrame - function AGSMW:GetBaseFrame() - local frame = CreateFrame("Frame", nil, UIParent) - frame:SetHeight(44) - frame:SetWidth(200) - - local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") - label:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) - label:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,0) - label:SetJustifyH("LEFT") - label:SetHeight(18) - label:SetText("") - frame.label = label - - local DLeft = frame:CreateTexture(nil, "ARTWORK") - DLeft:SetWidth(25) - DLeft:SetHeight(64) - DLeft:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -17, -21) - DLeft:SetTexture([[Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame]]) - DLeft:SetTexCoord(0, 0.1953125, 0, 1) - frame.DLeft = DLeft - - local DRight = frame:CreateTexture(nil, "ARTWORK") - DRight:SetWidth(25) - DRight:SetHeight(64) - DRight:SetPoint("TOP", DLeft, "TOP") - DRight:SetPoint("RIGHT", frame, "RIGHT", 17, 0) - DRight:SetTexture([[Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame]]) - DRight:SetTexCoord(0.8046875, 1, 0, 1) - frame.DRight = DRight - - local DMiddle = frame:CreateTexture(nil, "ARTWORK") - DMiddle:SetHeight(64) - DMiddle:SetPoint("TOP", DLeft, "TOP") - DMiddle:SetPoint("LEFT", DLeft, "RIGHT") - DMiddle:SetPoint("RIGHT", DRight, "LEFT") - DMiddle:SetTexture([[Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame]]) - DMiddle:SetTexCoord(0.1953125, 0.8046875, 0, 1) - frame.DMiddle = DMiddle - - local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlightSmall") - text:SetPoint("RIGHT",DRight,"RIGHT",-43,1) - text:SetPoint("LEFT",DLeft,"LEFT",26,1) - text:SetJustifyH("RIGHT") - text:SetHeight(18) - text:SetText("") - frame.text = text - - local dropButton = CreateFrame("Button", nil, frame) - dropButton:SetWidth(24) - dropButton:SetHeight(24) - dropButton:SetPoint("TOPRIGHT", DRight, "TOPRIGHT", -16, -18) - dropButton:SetNormalTexture([[Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up]]) - dropButton:SetPushedTexture([[Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down]]) - dropButton:SetDisabledTexture([[Interface\ChatFrame\UI-ChatIcon-ScrollDown-Disabled]]) - dropButton:SetHighlightTexture([[Interface\Buttons\UI-Common-MouseHilight]], "ADD") - frame.dropButton = dropButton - - frame.Disable = disable - frame.Enable = enable - return frame - end - - function AGSMW:GetBaseFrameWithWindow() - local frame = self:GetBaseFrame() - - local displayButton = CreateFrame("Button", nil, frame, BackdropTemplateMixin and "BackdropTemplate") - displayButton:SetHeight(42) - displayButton:SetWidth(42) - displayButton:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -2) - displayButton:SetBackdrop(displayButtonBackdrop) - displayButton:SetBackdropBorderColor(.5, .5, .5) - frame.displayButton = displayButton - - frame.label:SetPoint("TOPLEFT",displayButton,"TOPRIGHT",1,2) - - frame.DLeft:SetPoint("BOTTOMLEFT", displayButton, "BOTTOMRIGHT", -17, -20) - - return frame - end - -end - -do - - local sliderBackdrop = { - ["bgFile"] = [[Interface\Buttons\UI-SliderBar-Background]], - ["edgeFile"] = [[Interface\Buttons\UI-SliderBar-Border]], - ["tile"] = true, - ["edgeSize"] = 8, - ["tileSize"] = 8, - ["insets"] = { - ["left"] = 3, - ["right"] = 3, - ["top"] = 3, - ["bottom"] = 3, - }, - } - local frameBackdrop = { - bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], - edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], - tile = true, tileSize = 32, edgeSize = 32, - insets = { left = 11, right = 12, top = 12, bottom = 9 }, - } - - local function OnMouseWheel(self, dir) - self.slider:SetValue(self.slider:GetValue()+(15*dir*-1)) - end - - local function AddFrame(self, frame) - frame:SetParent(self.contentframe) - frame:SetFrameStrata(self:GetFrameStrata()) - frame:SetFrameLevel(self:GetFrameLevel() + 100) - - if next(self.contentRepo) then - frame:SetPoint("TOPLEFT", self.contentRepo[#self.contentRepo], "BOTTOMLEFT", 0, 0) - frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0) - self.contentframe:SetHeight(self.contentframe:GetHeight() + frame:GetHeight()) - self.contentRepo[#self.contentRepo+1] = frame - else - self.contentframe:SetHeight(frame:GetHeight()) - frame:SetPoint("TOPLEFT", self.contentframe, "TOPLEFT", 0, 0) - frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0) - self.contentRepo[1] = frame - end - - if self.contentframe:GetHeight() > UIParent:GetHeight()*2/5 - 20 then - self.scrollframe:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -28, 12) - self:SetHeight(UIParent:GetHeight()*2/5) - self.slider:Show() - self:SetScript("OnMouseWheel", OnMouseWheel) - self.slider:SetMinMaxValues(0, self.contentframe:GetHeight()-self.scrollframe:GetHeight()) - else - self.scrollframe:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -14, 12) - self:SetHeight(self.contentframe:GetHeight()+25) - self.slider:Hide() - self:SetScript("OnMouseWheel", nil) - self.slider:SetMinMaxValues(0, 0) - end - self.contentframe:SetWidth(self.scrollframe:GetWidth()) - end - - local function ClearFrames(self) - for i, frame in ipairs(self.contentRepo) do - frame:ReturnSelf() - self.contentRepo[i] = nil - end - end - - local function slider_OnValueChanged(self, value) - self.frame.scrollframe:SetVerticalScroll(value) - end - - local DropDownCache = {} - function AGSMW:GetDropDownFrame() - local frame - if next(DropDownCache) then - frame = table.remove(DropDownCache) - else - frame = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate") - frame:SetClampedToScreen(true) - frame:SetWidth(188) - frame:SetBackdrop(frameBackdrop) - frame:SetFrameStrata("TOOLTIP") - frame:EnableMouseWheel(true) - - local contentframe = CreateFrame("Frame", nil, frame) - contentframe:SetWidth(160) - contentframe:SetHeight(0) - frame.contentframe = contentframe - - local scrollframe = CreateFrame("ScrollFrame", nil, frame) - scrollframe:SetWidth(160) - scrollframe:SetPoint("TOPLEFT", frame, "TOPLEFT", 14, -13) - scrollframe:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -14, 12) - scrollframe:SetScrollChild(contentframe) - frame.scrollframe = scrollframe - - contentframe:SetPoint("TOPLEFT", scrollframe) - contentframe:SetPoint("TOPRIGHT", scrollframe) - - local bgTex = frame:CreateTexture(nil, "ARTWORK") - bgTex:SetAllPoints(scrollframe) - frame.bgTex = bgTex - - frame.AddFrame = AddFrame - frame.ClearFrames = ClearFrames - frame.contentRepo = {} -- store all our frames in here so we can get rid of them later - - local slider = CreateFrame("Slider", nil, scrollframe, BackdropTemplateMixin and "BackdropTemplate") - slider:SetOrientation("VERTICAL") - slider:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -14, -10) - slider:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -14, 10) - slider:SetBackdrop(sliderBackdrop) - slider:SetThumbTexture([[Interface\Buttons\UI-SliderBar-Button-Vertical]]) - slider:SetMinMaxValues(0, 1) - --slider:SetValueStep(1) - slider:SetWidth(12) - slider.frame = frame - slider:SetScript("OnValueChanged", slider_OnValueChanged) - frame.slider = slider - end - frame:SetHeight(UIParent:GetHeight()*2/5) - frame.slider:SetValue(0) - frame:Show() - return frame - end - - function AGSMW:ReturnDropDownFrame(frame) - ClearFrames(frame) - frame:ClearAllPoints() - frame:Hide() - frame:SetBackdrop(frameBackdrop) - frame.bgTex:SetTexture(nil) - table.insert(DropDownCache, frame) - return nil - end -end diff --git a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/widget.xml b/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/widget.xml deleted file mode 100644 index 43c46a1..0000000 --- a/Titan/libs/Ace/AceGUI-3.0-SharedMediaWidgets/AceGUI-3.0-SharedMediaWidgets/widget.xml +++ /dev/null @@ -1,9 +0,0 @@ - -