From 8368db24f2eb4023171399d7fd6e07b6da4058f8 Mon Sep 17 00:00:00 2001 From: D4KiR <23246564+d4kir92@users.noreply.github.com> Date: Sat, 3 Aug 2024 16:45:22 +0200 Subject: [PATCH] v0.5.75 --- DarkMode.toc | 2 +- DarkMode_Cata.toc | 2 +- DarkMode_TBC.toc | 2 +- DarkMode_Vanilla.toc | 2 +- DarkMode_Wrath.toc | 2 +- core.lua | 2 +- libs/D4Lib/D4MinimapButtons.lua | 39 +++++++++- libs/D4Lib/LibDBIcon-1.0/CHANGES.txt | 22 ++++-- libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0.toc | 2 +- .../LibDBIcon-1.0/LibDBIcon-1.0.lua | 77 +++++++++++-------- locale/deDE.lua | 6 +- locale/enUS.lua | 6 +- locale/zhcn.lua | 6 +- locale/zhtw.lua | 6 +- settings.lua | 4 +- 15 files changed, 123 insertions(+), 57 deletions(-) diff --git a/DarkMode.toc b/DarkMode.toc index 4d49c62..6eb396e 100644 --- a/DarkMode.toc +++ b/DarkMode.toc @@ -4,7 +4,7 @@ ## Interface-Cata: 40400 ## Interface: 100207, 110000 -## Version: 0.5.74 +## Version: 0.5.75 ## Title: DarkMode by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Cata.toc b/DarkMode_Cata.toc index 8132ead..ea66d39 100644 --- a/DarkMode_Cata.toc +++ b/DarkMode_Cata.toc @@ -1,5 +1,5 @@ ## Interface: 40400 -## Version: 0.5.74 +## Version: 0.5.75 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_TBC.toc b/DarkMode_TBC.toc index 00a33c1..c6c53a9 100644 --- a/DarkMode_TBC.toc +++ b/DarkMode_TBC.toc @@ -1,5 +1,5 @@ ## Interface: 20504 -## Version: 0.5.74 +## Version: 0.5.75 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Vanilla.toc b/DarkMode_Vanilla.toc index bb62029..f2782e1 100644 --- a/DarkMode_Vanilla.toc +++ b/DarkMode_Vanilla.toc @@ -1,5 +1,5 @@ ## Interface: 11503 -## Version: 0.5.74 +## Version: 0.5.75 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Wrath.toc b/DarkMode_Wrath.toc index 37754d4..5771f99 100644 --- a/DarkMode_Wrath.toc +++ b/DarkMode_Wrath.toc @@ -1,5 +1,5 @@ ## Interface: 30403 -## Version: 0.5.74 +## Version: 0.5.75 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/core.lua b/core.lua index 1b7b179..53164e3 100644 --- a/core.lua +++ b/core.lua @@ -1583,7 +1583,7 @@ function DarkMode:Event(event, ...) ["name"] = "DarkMode", ["icon"] = 136122, ["dbtab"] = DMTAB, - ["vTT"] = {"DarkMode", DarkMode:Trans("MMBTNLEFT"), DarkMode:Trans("MMBTNRIGHT")}, + ["vTT"] = {{"DarkMode |T136122:16:16:0:0|t", "v|cff3FC7EB0.5.75"}, {DarkMode:Trans("LEFTCLICK"), DarkMode:Trans("MMBTNLEFT")}, {DarkMode:Trans("RIGHTCLICK"), DarkMode:Trans("MMBTNRIGHT")}}, ["funcL"] = function() DarkMode:ToggleSettings() end, diff --git a/libs/D4Lib/D4MinimapButtons.lua b/libs/D4Lib/D4MinimapButtons.lua index ba1b3d7..cb9eb11 100644 --- a/libs/D4Lib/D4MinimapButtons.lua +++ b/libs/D4Lib/D4MinimapButtons.lua @@ -30,7 +30,7 @@ function D4:CreateMinimapButton(tab) OnTooltipShow = function(tooltip) if not tooltip or not tooltip.AddLine then return end for i, v in pairs(tab.vTT) do - tooltip:AddLine(v) + tooltip:AddDoubleLine(v[1], v[2]) end end, } @@ -39,6 +39,43 @@ function D4:CreateMinimapButton(tab) if mmbtn and D4:GetLibDBIcon() then D4:GetLibDBIcon():Register(tab.name, mmbtn, tab.dbtab) end + + if AddonCompartmentFrame then + AddonCompartmentFrame:RegisterAddon( + { + text = tab.name, + icon = tab.icon, + registerForAnyClick = true, + notCheckable = true, + func = function(button, menuInputData, menu) + local btnName = menuInputData.buttonName + if btnName == "LeftButton" and IsShiftKeyDown() and tab.funcSL then + tab:funcSL() + elseif btnName == "RightButton" and IsShiftKeyDown() and tab.funcSR then + tab:funcSR() + elseif btnName == "LeftButton" and tab.funcL then + tab:funcL() + elseif btnName == "RightButton" and tab.funcR then + tab:funcR() + end + end, + funcOnEnter = function(button) + MenuUtil.ShowTooltip( + button, + function(tooltip) + if not tooltip or not tooltip.AddLine then return end + for i, v in pairs(tab.vTT) do + tooltip:AddDoubleLine(v[1], v[2]) + end + end + ) + end, + funcOnLeave = function(button) + MenuUtil.HideTooltip(button) + end, + } + ) + end end end diff --git a/libs/D4Lib/LibDBIcon-1.0/CHANGES.txt b/libs/D4Lib/LibDBIcon-1.0/CHANGES.txt index 42dc949..b5e56d3 100644 --- a/libs/D4Lib/LibDBIcon-1.0/CHANGES.txt +++ b/libs/D4Lib/LibDBIcon-1.0/CHANGES.txt @@ -1,12 +1,20 @@ ------------------------------------------------------------------------ -r137 | funkehdude | 2024-07-09 18:35:23 +0000 (Tue, 09 Jul 2024) | 1 line +r141 | funkehdude | 2024-08-02 17:28:35 +0000 (Fri, 02 Aug 2024) | 1 line Changed paths: - M /trunk/LibDBIcon-1.0.toc - D /trunk/LibDBIcon-1.0_Cata.toc - D /trunk/LibDBIcon-1.0_TBC.toc - D /trunk/LibDBIcon-1.0_Vanilla.toc - D /trunk/LibDBIcon-1.0_Wrath.toc + M /trunk/LibDBIcon-1.0/LibDBIcon-1.0.lua -Merge toc files +Extra safety checks for the compartment +------------------------------------------------------------------------ +r140 | funkehdude | 2024-07-24 21:45:35 +0000 (Wed, 24 Jul 2024) | 1 line +Changed paths: + M /trunk/LibDBIcon-1.0/LibDBIcon-1.0.lua + +Update the compartment menu icon as needed +------------------------------------------------------------------------ +r139 | funkehdude | 2024-07-24 21:09:05 +0000 (Wed, 24 Jul 2024) | 1 line +Changed paths: + M /trunk/LibDBIcon-1.0/LibDBIcon-1.0.lua + +Compartment menu fixes for WoW 11 ------------------------------------------------------------------------ diff --git a/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0.toc b/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0.toc index 610097e..f55b4c6 100644 --- a/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0.toc +++ b/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0.toc @@ -1,5 +1,5 @@ ## Interface: 11502, 11503, 20504, 30403, 40400, 100207, 110000, 110002 -## Version: v10.2.3 +## Version: v11.0.0 ## LoadOnDemand: 1 ## Title: Lib: DataBrokerIcon-1.0 ## Notes: Allows addons to easily create a lightweight minimap icon as an alternative to heavier LDB displays. diff --git a/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0/LibDBIcon-1.0.lua b/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0/LibDBIcon-1.0.lua index c1cde47..46d6448 100644 --- a/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0/LibDBIcon-1.0.lua +++ b/libs/D4Lib/LibDBIcon-1.0/LibDBIcon-1.0/LibDBIcon-1.0.lua @@ -6,7 +6,7 @@ -- local DBICON10 = "LibDBIcon-1.0" -local DBICON10_MINOR = 52 -- Bump on changes +local DBICON10_MINOR = 55 -- Bump on changes if not LibStub then error(DBICON10 .. " requires LibStub.") end local ldb = LibStub("LibDataBroker-1.1", true) if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end @@ -25,6 +25,15 @@ function lib:IconCallback(event, name, key, value) if lib.objects[name] then if key == "icon" then lib.objects[name].icon:SetTexture(value) + if lib:IsButtonInCompartment(name) and lib:IsButtonCompartmentAvailable() then + local addonList = AddonCompartmentFrame.registeredAddons + for i =1, #addonList do + if addonList[i].text == name then + addonList[i].icon = value + return + end + end + end elseif key == "iconCoords" then lib.objects[name].icon:UpdateCoord() elseif key == "iconR" then @@ -94,8 +103,8 @@ local function onLeave(self) end end -local function onEnterCompartment(self) - local buttonName = self.value +local function onEnterCompartment(self, menu) + local buttonName = menu.text local object = lib.objects[buttonName] if object and object.dataObject then if object.dataObject.OnTooltipShow then @@ -109,10 +118,10 @@ local function onEnterCompartment(self) end end -local function onLeaveCompartment(self) +local function onLeaveCompartment(self, menu) lib.tooltip:Hide() - local buttonName = self.value + local buttonName = menu.text local object = lib.objects[buttonName] if object and object.dataObject then if object.dataObject.OnLeave then @@ -497,39 +506,43 @@ function lib:IsButtonInCompartment(buttonName) end function lib:AddButtonToCompartment(buttonName, customIcon) - local object = lib.objects[buttonName] - if object and not object.compartmentData and AddonCompartmentFrame then - if object.db then - object.db.showInCompartment = true + if lib:IsButtonCompartmentAvailable() then + local object = lib.objects[buttonName] + if object and not object.compartmentData then + if object.db then + object.db.showInCompartment = true + end + object.compartmentData = { + text = buttonName, + icon = customIcon or object.dataObject.icon, + notCheckable = true, + registerForAnyClick = true, + func = function(_, menuInputData, menu) + object.dataObject.OnClick(menu, menuInputData.buttonName) + end, + funcOnEnter = onEnterCompartment, + funcOnLeave = onLeaveCompartment, + } + AddonCompartmentFrame:RegisterAddon(object.compartmentData) end - object.compartmentData = { - text = buttonName, - icon = customIcon or object.dataObject.icon, - notCheckable = true, - registerForAnyClick = true, - func = function(frame, _, _, _, clickType) - object.dataObject.OnClick(frame, clickType) - end, - funcOnEnter = onEnterCompartment, - funcOnLeave = onLeaveCompartment, - } - AddonCompartmentFrame:RegisterAddon(object.compartmentData) end end function lib:RemoveButtonFromCompartment(buttonName) - local object = lib.objects[buttonName] - if object and object.compartmentData then - for i = 1, #AddonCompartmentFrame.registeredAddons do - local entry = AddonCompartmentFrame.registeredAddons[i] - if entry == object.compartmentData then - object.compartmentData = nil - if object.db then - object.db.showInCompartment = nil + if lib:IsButtonCompartmentAvailable() then + local object = lib.objects[buttonName] + if object and object.compartmentData then + for i = 1, #AddonCompartmentFrame.registeredAddons do + local entry = AddonCompartmentFrame.registeredAddons[i] + if entry == object.compartmentData then + object.compartmentData = nil + if object.db then + object.db.showInCompartment = nil + end + table.remove(AddonCompartmentFrame.registeredAddons, i) + AddonCompartmentFrame:UpdateDisplay() + return end - table.remove(AddonCompartmentFrame.registeredAddons, i) - AddonCompartmentFrame:UpdateDisplay() - return end end end diff --git a/locale/deDE.lua b/locale/deDE.lua index 4ffa7a7..04e4df0 100644 --- a/locale/deDE.lua +++ b/locale/deDE.lua @@ -1,7 +1,9 @@ -- deDE German Deutsch local _, DarkMode = ... -DarkMode:AddTrans("deDE", "MMBTNLEFT", "Linksklick => Optionen") -DarkMode:AddTrans("deDE", "MMBTNRIGHT", "Rechtsklick => Minimapknopf verstecken") +DarkMode:AddTrans("deDE", "LEFTCLICK", "Linksklick") +DarkMode:AddTrans("deDE", "RIGHTCLICK", "Rechtsklick") +DarkMode:AddTrans("deDE", "MMBTNLEFT", "Optionen") +DarkMode:AddTrans("deDE", "MMBTNRIGHT", "Minimapknopf verstecken") DarkMode:AddTrans("deDE", "GENERAL", "Allgemein") DarkMode:AddTrans("deDE", "MMBTN", "Minimapknopf anzeigen") DarkMode:AddTrans("deDE", "COLORMODE", "Farbmodus Ui") diff --git a/locale/enUS.lua b/locale/enUS.lua index 8e3e536..8a39a18 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -1,7 +1,9 @@ -- enUS English local _, DarkMode = ... -DarkMode:AddTrans("enUS", "MMBTNLEFT", "Left Click => Options") -DarkMode:AddTrans("enUS", "MMBTNRIGHT", "Right Click => Hide Minimap Button") +DarkMode:AddTrans("enUS", "LEFTCLICK", "Leftclick") +DarkMode:AddTrans("enUS", "RIGHTCLICK", "Rightclick") +DarkMode:AddTrans("enUS", "MMBTNLEFT", "Options") +DarkMode:AddTrans("enUS", "MMBTNRIGHT", "Hide Minimap Button") DarkMode:AddTrans("enUS", "GENERAL", "General") DarkMode:AddTrans("enUS", "MMBTN", "Show Minimap Button") DarkMode:AddTrans("enUS", "COLORMODE", "Color Mode Ui") diff --git a/locale/zhcn.lua b/locale/zhcn.lua index 543bc4a..46200c1 100644 --- a/locale/zhcn.lua +++ b/locale/zhcn.lua @@ -1,7 +1,9 @@ -- zhCN local _, DarkMode = ... -DarkMode:AddTrans("zhCN", "MMBTNLEFT", "左键点击 => 菜单选项") -DarkMode:AddTrans("zhCN", "MMBTNRIGHT", "右键点击 => 隐藏小地图按钮") +DarkMode:AddTrans("zhCN", "LEFTCLICK", "左键点击") +DarkMode:AddTrans("zhCN", "RIGHTCLICK", "右键点击") +DarkMode:AddTrans("zhCN", "MMBTNLEFT", "菜单选项") +DarkMode:AddTrans("zhCN", "MMBTNRIGHT", "隐藏小地图按钮") DarkMode:AddTrans("zhCN", "GENERAL", "常规") DarkMode:AddTrans("zhCN", "MMBTN", "显示小地图按钮") DarkMode:AddTrans("zhCN", "COLORMODE", "界面染色") diff --git a/locale/zhtw.lua b/locale/zhtw.lua index 0453c8e..fbd455b 100644 --- a/locale/zhtw.lua +++ b/locale/zhtw.lua @@ -1,7 +1,9 @@ -- zhTW local _, DarkMode = ... -DarkMode:AddTrans("zhTW", "MMBTNLEFT", "左鍵點擊 => 選項設定") -DarkMode:AddTrans("zhTW", "MMBTNRIGHT", "右鍵點擊 => 隱藏小地圖按鈕") +DarkMode:AddTrans("zhTW", "LEFTCLICK", "左鍵點擊") +DarkMode:AddTrans("zhTW", "RIGHTCLICK", "右鍵點擊") +DarkMode:AddTrans("zhTW", "MMBTNLEFT", "選項設定") +DarkMode:AddTrans("zhTW", "MMBTNRIGHT", "隱藏小地圖按鈕") DarkMode:AddTrans("zhTW", "GENERAL", "一般") DarkMode:AddTrans("zhTW", "MMBTN", "顯示小地圖按鈕") DarkMode:AddTrans("zhTW", "COLORMODE", "介面著色") diff --git a/settings.lua b/settings.lua index d38463d..524a2a5 100644 --- a/settings.lua +++ b/settings.lua @@ -289,8 +289,8 @@ function DarkMode:InitDMSettings() DMSettings:Hide() end - DarkMode:SetVersion(AddonName, 136122, "0.5.74") - DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.74")) + DarkMode:SetVersion(AddonName, 136122, "0.5.75") + DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.75")) DMSettings.CloseButton:SetScript( "OnClick", function()