From cc362f66b390821387cd16031dfbd3c4c0b9c30b Mon Sep 17 00:00:00 2001 From: D4KiR <23246564+d4kir92@users.noreply.github.com> Date: Wed, 2 Oct 2024 09:01:41 +0200 Subject: [PATCH] v0.5.113 --- DarkMode.toc | 2 +- DarkMode_Cata.toc | 2 +- DarkMode_TBC.toc | 2 +- DarkMode_Vanilla.toc | 2 +- DarkMode_Wrath.toc | 2 +- core.lua | 2 +- data.lua | 6 ++-- libs/D4Lib/D4Frames.lua | 76 +++++++++++++++++++++++++++++------------ settings.lua | 4 +-- 9 files changed, 66 insertions(+), 32 deletions(-) diff --git a/DarkMode.toc b/DarkMode.toc index 6e471ac..a9effe0 100644 --- a/DarkMode.toc +++ b/DarkMode.toc @@ -4,7 +4,7 @@ ## Interface-Cata: 40400 ## Interface: 110002 -## Version: 0.5.112 +## Version: 0.5.113 ## 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 2113b72..7ffc2d1 100644 --- a/DarkMode_Cata.toc +++ b/DarkMode_Cata.toc @@ -1,5 +1,5 @@ ## Interface: 40400 -## Version: 0.5.112 +## Version: 0.5.113 ## 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 8e126c3..67f3186 100644 --- a/DarkMode_TBC.toc +++ b/DarkMode_TBC.toc @@ -1,5 +1,5 @@ ## Interface: 20504 -## Version: 0.5.112 +## Version: 0.5.113 ## 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 4ec20bf..0f6be0d 100644 --- a/DarkMode_Vanilla.toc +++ b/DarkMode_Vanilla.toc @@ -1,5 +1,5 @@ ## Interface: 11504 -## Version: 0.5.112 +## Version: 0.5.113 ## 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 b85f715..25d4ca2 100644 --- a/DarkMode_Wrath.toc +++ b/DarkMode_Wrath.toc @@ -1,5 +1,5 @@ ## Interface: 30403 -## Version: 0.5.112 +## Version: 0.5.113 ## 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 bdbbcb0..1ef2d85 100644 --- a/core.lua +++ b/core.lua @@ -1619,7 +1619,7 @@ function DarkMode:Event(event, ...) ["name"] = "DarkMode", ["icon"] = 136122, ["dbtab"] = DMTAB, - ["vTT"] = {{"DarkMode |T136122:16:16:0:0|t", "v|cff3FC7EB0.5.112"}, {DarkMode:Trans("LEFTCLICK"), DarkMode:Trans("MMBTNLEFT")}, {DarkMode:Trans("RIGHTCLICK"), DarkMode:Trans("MMBTNRIGHT")}}, + ["vTT"] = {{"DarkMode |T136122:16:16:0:0|t", "v|cff3FC7EB0.5.113"}, {DarkMode:Trans("LEFTCLICK"), DarkMode:Trans("MMBTNLEFT")}, {DarkMode:Trans("RIGHTCLICK"), DarkMode:Trans("MMBTNRIGHT")}}, ["funcL"] = function() DarkMode:ToggleSettings() end, diff --git a/data.lua b/data.lua index 27dac7d..9b2015f 100644 --- a/data.lua +++ b/data.lua @@ -129,9 +129,9 @@ function DarkMode:GetDMRepeatingFrames2() end local DMUi = { - ["ActionButtons"] = {"PetActionButton", "ActionButton", "MultiBarBottomLeftButton", "MultiBarBottomRightButton", "MultiBarLeftButton", "MultiBarRightButton", "ActionBar7Button", "ActionBar8Button", "ActionBar9Button", "ActionBar10Button", "MultiBar5Button", "MultiBar6Button", "MultiBar7Button", "StanceButton", "PetActionButton", "BT4Button", "BT4StanceButton", "BT4PetButton", "DominosActionButton"}, + ["ActionButtons"] = {"PetActionButton", "ActionButton", "MultiBarBottomLeftButton", "MultiBarBottomRightButton", "MultiBarLeftButton", "MultiBarRightButton", "ActionBar7Button", "ActionBar8Button", "ActionBar9Button", "ActionBar10Button", "MultiBar5Button", "MultiBar6Button", "MultiBar7Button", "StanceButton", "PetActionButton", "BT4Button", "BT4StanceButton", "BT4PetButton", "DominosActionButton", "MultiBarBottomLeftActionButton", "MultiBarBottomRightActionButton", "MultiBarLeftActionButton", "MultiBarRightActionButton", "MultiBarBottomRightActionButton", "MultiBar5ActionButton", "MultiBar6ActionButton", "MultiBar7ActionButton"}, ["Minimap"] = {"CalendarButtonFrame", "MiniMapBattlefieldBorder", "MinimapBorder", "MinimapBorderTop", "TimeManagerClockButton", "MinimapCompassTexture", "MinimapCluster.BorderTop",}, - ["UnitFrames"] = {"FocusFrameToT", "TargetFrameToT", "ArenaEnemyFrame1Texture", "ArenaEnemyFrame2Texture", "ArenaEnemyFrame3Texture", "ArenaEnemyFrame4Texture", "ArenaEnemyFrame5Texture", "PlayerFrameAlternateManaBarBorder", "Boss1TargetFrameTextureFrame", "Boss2TargetFrameTextureFrame", "Boss3TargetFrameTextureFrame", "Boss4TargetFrameTextureFrame", "Boss5TargetFrameTextureFrame", "PlayerFrameTexture", "TargetFrameTextureFrameTexture", "FocusFrameTextureFrameTexture", "TargetFrameToTTextureFrameTexture", "FocusFrameToTTextureFrameTexture", "PetFrameTexture", "PlayerFrame.PlayerFrameContainer.AlternatePowerFrameTexture", "PlayerFrame.PlayerFrameContainer.FrameTexture", "TargetFrame.TargetFrameContainer.FrameTexture", "FocusFrame.TargetFrameContainer.FrameTexture", "PartyMemberFrame1Texture", "PartyMemberFrame2Texture", "PartyMemberFrame3Texture", "PartyMemberFrame4Texture", "PartyFrame.MemberFrame1.Texture", "PartyFrame.MemberFrame2.Texture", "PartyFrame.MemberFrame3.Texture", "PartyFrame.MemberFrame4.Texture"}, + ["UnitFrames"] = {"FocusFrameToT", "TargetFrameToT", "CompactArenaFrame.PreMatchFramesContainer.PreMatchFrame1.SpecPortraitBorderTexture", "CompactArenaFrame.PreMatchFramesContainer.PreMatchFrame2.SpecPortraitBorderTexture", "CompactArenaFrame.PreMatchFramesContainer.PreMatchFrame3.SpecPortraitBorderTexture", "CompactArenaFrame.PreMatchFramesContainer.PreMatchFrame4.SpecPortraitBorderTexture", "CompactArenaFrame.PreMatchFramesContainer.PreMatchFrame5.SpecPortraitBorderTexture", "ArenaPrepFrame1Texture", "ArenaPrepFrame2Texture", "ArenaPrepFrame3Texture", "ArenaPrepFrame4Texture", "ArenaPrepFrame5Texture", "ArenaEnemyFrame1Texture", "ArenaEnemyFrame2Texture", "ArenaEnemyFrame3Texture", "ArenaEnemyFrame4Texture", "ArenaEnemyFrame5Texture", "PlayerFrameAlternateManaBarBorder", "Boss1TargetFrameTextureFrame", "Boss2TargetFrameTextureFrame", "Boss3TargetFrameTextureFrame", "Boss4TargetFrameTextureFrame", "Boss5TargetFrameTextureFrame", "PlayerFrameTexture", "TargetFrameTextureFrameTexture", "FocusFrameTextureFrameTexture", "TargetFrameToTTextureFrameTexture", "FocusFrameToTTextureFrameTexture", "PetFrameTexture", "PlayerFrame.PlayerFrameContainer.AlternatePowerFrameTexture", "PlayerFrame.PlayerFrameContainer.FrameTexture", "TargetFrame.TargetFrameContainer.FrameTexture", "FocusFrame.TargetFrameContainer.FrameTexture", "PartyMemberFrame1Texture", "PartyMemberFrame2Texture", "PartyMemberFrame3Texture", "PartyMemberFrame4Texture", "PartyFrame.MemberFrame1.Texture", "PartyFrame.MemberFrame2.Texture", "PartyFrame.MemberFrame3.Texture", "PartyFrame.MemberFrame4.Texture"}, ["Tooltips"] = {"DropDownList1MenuBackdrop.NineSlice", "DropDownList2MenuBackdrop.NineSlice", "DropDownList3MenuBackdrop.NineSlice", "DropDownList4MenuBackdrop.NineSlice", "GameTooltip.NineSlice", "ItemRefTooltip.NineSlice", "ShoppingTooltip1.NineSlice", "ShoppingTooltip2.NineSlice", "WhatsTrainingTooltip.NineSlice"}, ["Artworks"] = {"PaladinPowerBarFrame", "PaladinPowerBarFrame.ActiveTexture", "PaladinPowerBarFrame.Background", "TimerTrackerTimer1StatusBarBorder", "TimerTrackerTimer2StatusBarBorder", "MirrorTimer1", "MirrorTimer2", "MirrorTimer3", "MainMenuBar.BorderArt", "MainMenuBarTextureExtender", "StanceBarLeft", "StanceBarMiddle", "StanceBarRight", "StanceButton1NormalTexture2", "StanceButton2NormalTexture2", "StanceButton3NormalTexture2", "StanceButton4NormalTexture2", "StanceButton5NormalTexture2", "StanceButton6NormalTexture2", "StanceButton7NormalTexture2", "StanceButton8NormalTexture2", "SlidingActionBarTexture0", "SlidingActionBarTexture1", "MainMenuBarTexture0", "MainMenuBarTexture1", "MainMenuBarTexture2", "MainMenuBarTexture3", "MainMenuExpBar", "ReputationWatchBar.StatusBar", "MainStatusTrackingBarContainer.BarFrameTexture", "SecondaryStatusTrackingBarContainer.BarFrameTexture", "MainMenuBarMaxLevelBar", "BT4BarBlizzardArt", "BT4BarBlizzardArt.nineSliceParent", "BlizzardArtLeftCap", "BlizzardArtRightCap", "CompactRaidFrameManager", "CharacterReagentBag0SlotNormalTexture", "CharacterBag0SlotNormalTexture", "CharacterBag1SlotNormalTexture", "CharacterBag2SlotNormalTexture", "CharacterBag3SlotNormalTexture", "MainMenuBarBackpackButtonNormalTexture"}, ["Gryphons"] = {"MA_LeftEndCap", "MA_RightEndCap", "MainMenuBar.EndCaps", "MainMenuBarLeftEndCap", "MainMenuBarRightEndCap"}, @@ -155,7 +155,7 @@ function DarkMode:GetUiTable() return DMUi end -local DMUiAddons = {"TimerTrackerTimer1StatusBarBorder", "TimerTrackerTimer2StatusBarBorder", "FocusFrame.FocusFrameContainer.FrameTexture"} +local DMUiAddons = {"TimerTrackerTimer1StatusBarBorder", "TimerTrackerTimer2StatusBarBorder", "FocusFrame.FocusFrameContainer.FrameTexture", "ArenaPrepFrame1Texture", "ArenaPrepFrame2Texture", "ArenaPrepFrame3Texture", "ArenaPrepFrame4Texture", "ArenaPrepFrame5Texture", "ArenaEnemyFrame1Texture", "ArenaEnemyFrame2Texture", "ArenaEnemyFrame3Texture", "ArenaEnemyFrame4Texture", "ArenaEnemyFrame5Texture",} function DarkMode:GetUiAddonsTable() return DMUiAddons end diff --git a/libs/D4Lib/D4Frames.lua b/libs/D4Lib/D4Frames.lua index 45ecc0d..ec0b40c 100644 --- a/libs/D4Lib/D4Frames.lua +++ b/libs/D4Lib/D4Frames.lua @@ -1,4 +1,5 @@ local _, D4 = ... +local X = 0 local Y = 0 local PARENT = nil local TAB = nil @@ -14,7 +15,11 @@ function D4:AddCategory(tab) tab.parent.f:SetText(D4:Trans(tab.name)) end -function D4:CreateCheckbox(tab) +function D4:CreateCheckbox(tab, text) + if text == nil then + text = true + end + tab.sw = tab.sw or 25 tab.sh = tab.sh or 25 tab.parent = tab.parent or UIParent @@ -31,9 +36,11 @@ function D4:CreateCheckbox(tab) end ) - cb.f = cb:CreateFontString(nil, nil, "GameFontNormal") - cb.f:SetPoint("LEFT", cb, "RIGHT", 0, 0) - cb.f:SetText(D4:Trans(tab.name)) + if text then + cb.f = cb:CreateFontString(nil, nil, "GameFontNormal") + cb.f:SetPoint("LEFT", cb, "RIGHT", 0, 0) + cb.f:SetText(D4:Trans(tab.name)) + end return cb end @@ -62,6 +69,22 @@ function D4:CreateCheckboxForCVAR(tab) return cb end +function D4:CreateSliderForCVAR(tab) + tab.sw = tab.sw or 25 + tab.sh = tab.sh or 25 + tab.parent = tab.parent or UIParent + tab.pTab = tab.pTab or "CENTER" + tab.value = tab.value or nil + local cb = D4:CreateCheckbox(tab, false) + tab.sw = 460 + tab.value = tab.value2 + tab.key = tab.key or tab.name or "" + tab.pTab = {tab.pTab[1], tab.pTab[2] + 32, tab.pTab[3] - 18} + D4:CreateSlider(tab) + + return cb +end + function D4:CreateEditBox(tab) tab.sw = tab.sw or 200 tab.sh = tab.sh or 25 @@ -91,7 +114,7 @@ function D4:CreateSlider(tab) D4:MSG("[D4][CreateSlider] Missing format string:", tab.key, tab.value) return - elseif tab.value == nil then + elseif tab.value == nil or type(tonumber(tab.value)) ~= "number" then D4:MSG("[D4][CreateSlider] Missing value:", tab.key, tab.value) return @@ -154,7 +177,9 @@ function D4:CreateSlider(tab) TAB[tab.key] = val end - if tab.funcV then + if tab.funcV2 then + tab:funcV2(val) + elseif tab.funcV then tab:funcV(val) end @@ -218,6 +243,14 @@ function D4:CreateFrame(tab) return fra end +function D4:SetAppendX(newX) + X = newX +end + +function D4:GetAppendX() + return X +end + function D4:SetAppendY(newY) Y = newY end @@ -249,7 +282,7 @@ function D4:AppendCategory(name, x, y) { ["name"] = name, ["parent"] = PARENT, - ["pTab"] = {"TOPLEFT", x or 5, y or Y}, + ["pTab"] = {"TOPLEFT", x or X, y or Y}, } ) @@ -260,7 +293,7 @@ end function D4:AppendCheckbox(key, value, func, x, y) value = value or false - x = x or 5 + x = x or X if TAB == nil then if TABIsNil == false then TABIsNil = true @@ -279,7 +312,7 @@ function D4:AppendCheckbox(key, value, func, x, y) { ["name"] = key, ["parent"] = PARENT, - ["pTab"] = {"TOPLEFT", x, y or Y}, + ["pTab"] = {"TOPLEFT", x or X, y or Y}, ["value"] = val, ["funcV"] = function(sel, checked) TAB[key] = checked @@ -331,7 +364,7 @@ function D4:AppendSlider(key, value, min, max, steps, decimals, func, lstr) slider.decimals = decimals slider.color = {0, 1, 0, 1} slider.func = func - slider.pTab = {"TOPLEFT", 10, Y} + slider.pTab = {"TOPLEFT", X + 5, Y} D4:CreateSlider(slider) Y = Y - 30 end @@ -342,23 +375,23 @@ function D4:CreateDropdown(key, value, choices, parent) end local text = parent:CreateFontString(nil, nil, "GameFontNormal") - text:SetPoint("TOPLEFT", 10, Y) + text:SetPoint("TOPLEFT", X + 5, Y) text:SetText(D4:Trans(key)) Y = Y - 18 if D4:GetWoWBuild() == "RETAIL" then local Dropdown = CreateFrame("DropdownButton", key, parent, "WowStyle1DropdownTemplate") - Dropdown:SetDefaultText(choices[TAB[key]]) - Dropdown:SetPoint("TOPLEFT", 10, Y) + Dropdown:SetDefaultText(D4:Trans(choices[TAB[key]])) + Dropdown:SetPoint("TOPLEFT", X + 5, Y) Dropdown:SetWidth(200) Dropdown:SetupMenu( function(dropdown, rootDescription) rootDescription:CreateTitle(D4:Trans(key)) - for i, v in pairs(choices) do + for data, name in pairs(choices) do rootDescription:CreateButton( - i, + D4:Trans(name), function() - TAB[key] = v - Dropdown:SetDefaultText(i) + TAB[key] = data + Dropdown:SetDefaultText(D4:Trans(name)) end ) end @@ -371,10 +404,10 @@ function D4:CreateDropdown(key, value, choices, parent) function WPDropDownDemo_Menu(frame, level, menuList) local info = UIDropDownMenu_CreateInfo() if level == 1 then - for i, v in pairs(choices) do - info.text = v - info.arg1 = i - info.checked = v == choices[TAB[key]] + for data, name in pairs(choices) do + info.text = D4:Trans(name) + info.arg1 = data + info.checked = name == choices[TAB[key]] info.func = dropDown.SetValue UIDropDownMenu_AddButton(info) end @@ -392,6 +425,7 @@ function D4:CreateDropdown(key, value, choices, parent) end function D4:AppendDropdown(key, value, choices) + Y = Y - 10 D4:CreateDropdown(key, value, choices, PARENT) Y = Y - 30 end diff --git a/settings.lua b/settings.lua index 346ad01..2a2e378 100644 --- a/settings.lua +++ b/settings.lua @@ -372,8 +372,8 @@ function DarkMode:InitDMSettings() DMSettings:Hide() end - DarkMode:SetVersion(AddonName, 136122, "0.5.112") - DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.112")) + DarkMode:SetVersion(AddonName, 136122, "0.5.113") + DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.113")) DMSettings.CloseButton:SetScript( "OnClick", function()