From cc7903769dbd90319be669cc5628a8bc80588b27 Mon Sep 17 00:00:00 2001 From: urnati Date: Mon, 31 Oct 2022 22:13:51 -0400 Subject: [PATCH] - Updated TOC - A TON of cleanup after DragonFlight changes - Allow plugins based on Icon & Text templates to be left / center - Add current spec and loot spec to Loot Type - Fixed placement of plugin control frames (Clock & Volume). TitanPanelButton_OnClick was busted forcing Clock & Volume to write their own. - In plugins, moved frame declaration from XML to code for clarity and, hopefully, a touch easier to maintain --- Titan/LDBToTitan.lua | 48 +- Titan/Titan.toc | 6 +- Titan/TitanAutoHide.lua | 70 +++ Titan/TitanAutoHide.xml | 38 -- Titan/TitanConfig.lua | 133 +---- Titan/TitanMovable.lua | 1034 +-------------------------------- Titan/TitanPanel.lua | 148 +---- Titan/TitanPanel.xml | 185 ------ Titan/TitanPanelTemplate.lua | 81 ++- Titan/TitanUtils.lua | 89 ++- TitanBag/TitanBag.lua | 60 +- TitanBag/TitanBag.toc | 6 +- TitanBag/TitanBag.xml | 23 - TitanClock/TitanClock.lua | 224 +++++-- TitanClock/TitanClock.toc | 6 +- TitanClock/TitanClock.xml | 135 ----- TitanGold/TitanGold.lua | 42 +- TitanGold/TitanGold.toc | 6 +- TitanGold/TitanGold.xml | 26 - TitanLocation/TitanLocation.lua | 46 +- TitanLocation/TitanLocation.toc | 6 +- TitanLocation/TitanLocation.xml | 30 - TitanLootType/TitanLootType.lua | 161 ++++- TitanLootType/TitanLootType.toc | 6 +- TitanLootType/TitanLootType.xml | 23 - TitanPerformance/TitanPerformance.lua | 99 +++- TitanPerformance/TitanPerformance.toc | 6 +- TitanPerformance/TitanPerformance.xml | 109 ---- TitanRepair/TitanRepair.lua | 41 +- TitanRepair/TitanRepair.toc | 6 +- TitanRepair/TitanRepair.xml | 21 - TitanVolume/TitanVolume.lua | 225 ++++++- TitanVolume/TitanVolume.toc | 6 +- TitanVolume/TitanVolume.xml | 326 ----------- TitanXP/TitanXP.lua | 76 ++- TitanXP/TitanXP.toc | 6 +- TitanXP/TitanXP.xml | 29 - 37 files changed, 1072 insertions(+), 2510 deletions(-) delete mode 100644 Titan/TitanAutoHide.xml delete mode 100644 TitanBag/TitanBag.xml delete mode 100644 TitanClock/TitanClock.xml delete mode 100644 TitanGold/TitanGold.xml delete mode 100644 TitanLocation/TitanLocation.xml delete mode 100644 TitanLootType/TitanLootType.xml delete mode 100644 TitanPerformance/TitanPerformance.xml delete mode 100644 TitanRepair/TitanRepair.xml delete mode 100644 TitanVolume/TitanVolume.xml delete mode 100644 TitanXP/TitanXP.xml diff --git a/Titan/LDBToTitan.lua b/Titan/LDBToTitan.lua index 4d55188..4644cfe 100644 --- a/Titan/LDBToTitan.lua +++ b/Titan/LDBToTitan.lua @@ -7,7 +7,7 @@ NAME: Titan LDB overview DESC: Titan will automatically convert a LDB type addon to a Titan plugin. Only LDB types listed in the LDB 1.1 spec are supported. Custom types are not supported. -Supported +Supported type - "launcher" become "icon" plugins icon* - always shown OnClick* - @@ -24,6 +24,15 @@ Supported tooltip OnTooltipShow - +- "macro" become "combo" plugins with icon; a tooltip/Click; and optional label + icon^ - + commandtext^ - + label^ - + OnEnter - + OnLeave - + tooltip + OnTooltipShow - + * required by LDB spec ^ user controlled show / hide :DESC @@ -423,12 +432,8 @@ end NAME: TitanLDBShowText DESC: Text callback for the Titan (LDB) plugin when the LDB addon changes display text VAR: name - id of the plugin -OUT: None -NOTE: -- One interpretation of 1.1 spec to show text is either -1) use .text or use .value & .suffix (Titan implements) -2) always use .text but .value & .suffix are parts if needed -:NOTE +OUT: label of text to show +OUT: text to show --]] function TitanLDBShowText(name) -- Set 'label1' and 'value1' for the Titan button display @@ -454,13 +459,10 @@ function TitanLDBShowText(name) end -- Check for display text - if TitanGetVar(name, "ShowRegularText") then - if ldb.suffix and ldb.suffix ~="" then - val1 = (ldb.value or "").." "..ldb.suffix - else - val1 = (ldb.text or "") - end - end + val1 = (ldb.text or "") + -- .text is required to show + -- .value is the text of the value - 100.0 in 100.0 FPS + -- .suffix is the text after the value - FPS in 100.0 FPS else -- return values will be empty strings end @@ -690,14 +692,12 @@ function LDBToTitan:TitanLDBCreateObject(_, name, obj) controlVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = false, ShowColoredText = false, DisplayOnRightSide = true }, savedVariables = { ShowIcon = true, ShowLabelText = true, - ShowRegularText = true, ShowColoredText = false, DisplayOnRightSide = false }, @@ -744,25 +744,18 @@ function LDBToTitan:TitanLDBCreateObject(_, name, obj) -- controls -- one interpretation of the LDB spec is launchers -- should always have an icon. - registry["controlVariables"].ShowIcon = false; - registry["controlVariables"].ShowRegularText = false; -- no text + registry["controlVariables"].ShowIcon = true; -- defaults - registry["savedVariables"].ShowRegularText = false; registry["savedVariables"].DisplayOnRightSide = true; -- start on right side end if obj.type == DATA_SOURCE then -- controls - registry["controlVariables"].ShowRegularText = true; -- defaults - registry["savedVariables"].ShowRegularText = true; end -- - -- Create the frame for this LDB addon - -- - - -- Create the Titan Frame ... + -- Create the Titan frame for this LDB addon -- Titan _OnLoad will be used to request the plugin be registered by Titan local newTitanFrame -- a frame if obj.type == "macro" then -- custom @@ -842,7 +835,6 @@ VAR: function OUT: None NOTE: - PLAYER_LOGIN - Read through all the LDB object created so far and create cooresponding Titan plugins. -- PLAYER_ENTERING_WORLD - Create a one time timer. This helps ensure the latest values are displayed on the plugin. Some LDB addons create their objects then update the addon values. Titan could have missed the updates as it created & registered the Titan plugin. :NOTE --]] LDBToTitan:SetScript("OnEvent", function(self, event, ...) @@ -861,10 +853,6 @@ LDBToTitan:SetScript("OnEvent", function(self, event, ...) if (event == "PLAYER_ENTERING_WORLD") then self:UnregisterEvent("PLAYER_ENTERING_WORLD") - -- Ensure all plugins (for LDB) are refreshed. - -- Some LDB plugins may have updated text, icon, etc - -- before the plugin was registered so be nice and schedule a refresh --- TitanMovable_AdjustTimer("LDBRefresh") end end ) \ No newline at end of file diff --git a/Titan/Titan.toc b/Titan/Titan.toc index 9616f31..f4961c4 100644 --- a/Titan/Titan.toc +++ b/Titan/Titan.toc @@ -1,7 +1,7 @@ ## Interface: 100000 -## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa006.00.04.100000|r +## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa006.00.05.100000|r ## Author: Titan Panel Development Team -## Version: 6.00.04.100000 +## Version: 6.00.05.100000 ## SavedVariables: TitanAll, TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat ## OptionalDeps: Ace3, AceGUI-3.0-SharedMediaWidgets, LibSharedMedia-3.0, LibQTip-1.0, !LibUIDropDownMenu ## Notes: Adds a display bar on the top and/or bottom of the screen. Allows users to show and control information/launcher plugins. @@ -32,10 +32,10 @@ locale\Localization.TW.lua TitanUtils.lua TitanVariables.lua -TitanAutoHide.lua TitanPanelTemplate.xml TitanMovable.lua TitanConfig.lua +TitanAutoHide.lua TitanPanel.xml TitanPanel.lua LDBToTitan.lua diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua index 918b81b..76af2d2 100644 --- a/Titan/TitanAutoHide.lua +++ b/Titan/TitanAutoHide.lua @@ -178,3 +178,73 @@ function Handle_OnUpdateAutoHide(frame) TitanPanelBarButton_Hide(frame) end end + +-- ====== Create needed frames +local function Create_Hide_Button(name, f) + local window = CreateFrame("Button", name, f, "TitanPanelIconTemplate") + window:SetFrameStrata("FULLSCREEN") + -- Using SetScript("OnLoad", does not work + Titan_AutoHide_OnLoad(window); +-- TitanPanelButton_OnLoad(window); -- Titan XML template calls this... + + window:SetScript("OnShow", function(self) + Titan_AutoHide_OnShow(self) + end) + window:SetScript("OnClick", function(self, button) + Titan_AutoHide_OnClick(self, button); + TitanPanelButton_OnClick(self, button); + end) +end + +local function Create_Frames() + if _G[TITAN_BUTTON] then + return -- if already created + end + + -- Display & Hide bars + local top1_d = CreateFrame("Button", "Titan_Bar__Display_Bar", UIParent, "Titan_Bar__Display_Template") + top1_d:SetFrameStrata("DIALOG") + top1_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0) + top1_d:SetPoint("BOTTOMRIGHT", UIParent, "TOPRIGHT", 0, -24) + local top1_h = CreateFrame("Button", "Titan_Bar__Hider_Bar", UIParent, "TitanPanelBarButtonHiderTemplate") + top1_h:SetFrameStrata("DIALOG") + top1_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local top2_d = CreateFrame("Button", "Titan_Bar__Display_Bar2", UIParent, "Titan_Bar__Display_Template") + top2_d:SetFrameStrata("DIALOG") + top2_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 24) + top2_d:SetPoint("BOTTOMRIGHT", UIParent, "TOPRIGHT", 0, 48) + local top2_h = CreateFrame("Button", "Titan_Bar__Hider_Bar2", UIParent, "TitanPanelBarButtonHiderTemplate") + top2_h:SetFrameStrata("DIALOG") + top2_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local bot1_d = CreateFrame("Button", "Titan_Bar__Display_AuxBar", UIParent, "Titan_Bar__Display_Template") + bot1_d:SetFrameStrata("DIALOG") + bot1_d:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) + bot1_d:SetPoint("TOPRIGHT", UIParent, "BOTTOMRIGHT", 0, 24) + local bot1_h = CreateFrame("Button", "Titan_Bar__Hider_AuxBar", UIParent, "TitanPanelBarButtonHiderTemplate") + bot1_h:SetFrameStrata("DIALOG") + bot1_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + local bot2_d = CreateFrame("Button", "Titan_Bar__Display_AuxBar2", UIParent, "Titan_Bar__Display_Template") + bot2_d:SetFrameStrata("DIALOG") + bot2_d:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 24) + bot2_d:SetPoint("TOPRIGHT", UIParent, "BOTTOMRIGHT", 0, 48) + local bot2_h = CreateFrame("Button", "Titan_Bar__Hider_AuxBar2", UIParent, "TitanPanelBarButtonHiderTemplate") + bot2_h:SetFrameStrata("DIALOG") + bot2_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + + -- general container frame + local f = CreateFrame("Frame", nil, UIParent) +-- f:Hide() + + -- Titan Auto hide Buttons + Create_Hide_Button("TitanPanelAutoHide_BarButton", f) + Create_Hide_Button("TitanPanelAutoHide_Bar2Button", f) + Create_Hide_Button("TitanPanelAutoHide_AuxBar2Button", f) + Create_Hide_Button("TitanPanelAutoHide_AuxBarButton", f) + +end + + +Create_Frames() -- do the work diff --git a/Titan/TitanAutoHide.xml b/Titan/TitanAutoHide.xml deleted file mode 100644 index 9627f42..0000000 --- a/Titan/TitanAutoHide.xml +++ /dev/null @@ -1,38 +0,0 @@ - -