From d87235b8b35a1f7826752efb164f6a1201eb27b4 Mon Sep 17 00:00:00 2001 From: urnati Date: Sun, 14 Nov 2021 11:00:47 -0500 Subject: [PATCH] - Add backdrop (hopefully last time!) to built-in plugin tooltips - Clock, Performace, Volume --- Titan/TitanUtils.lua | 74 ++++++++++---------------- TitanClock/TitanClock.lua | 88 +++++++++++++++++-------------- TitanPerformance/TitanPerformance.lua | 93 +++++++++++---------------------- TitanVolume/TitanVolume.lua | 39 +++----------- 4 files changed, 114 insertions(+), 180 deletions(-) diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 42abe72..8150fd0 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -696,16 +696,6 @@ end -- "TitanPanelRightClickMenu_Prepare"...."Menu" -- --[[ API -NAME: TitanPanelRightClickMenu_GetDropdownLevel -DESC: Menu - add given info (button) at the given level in the form of a button. -VAR: None -OUT: int - dropdown menu level ---]] -function TitanPanelRightClickMenu_GetDropdownLevel() - return _G["L_UIDROPDOWNMENU_MENU_LEVEL"] -end - ---[[ API NAME: TitanPanelRightClickMenu_AddTitle DESC: Menu - add a title at the given level in the form of a button. VAR: title - text to show @@ -724,19 +714,6 @@ function TitanPanelRightClickMenu_AddTitle(title, level) end --[[ API -NAME: TitanPanelRightClickMenu_AddButton -DESC: Menu - add given info (button) at the given level in the form of a button. -VAR: info - text / button / command to show -VAR: level - level to put text -OUT: None ---]] -function TitanPanelRightClickMenu_AddButton(info, level) - if (info) then - DDM:UIDropDownMenu_AddButton(info, level); - end -end - ---[[ API NAME: TitanPanelRightClickMenu_AddCommand DESC: Menu - add a command at the given level in the form of a button. VAR: title - text to show @@ -843,29 +820,6 @@ function TitanPanelRightClickMenu_AddToggleColoredText(id, level) end --[[ API -NAME: TitanPanelRightClickMenu_AddToggleRightSide -DESC: Menu - add a toggle Right Side (localized) command at the given level in the form of a button. Titan will properly control the "DisplayOnRightSide" -VAR: id - id of the plugin -VAR: level - level to put the line -OUT: None ---]] -function TitanPanelRightClickMenu_AddToggleRightSide(id, level) - -- copy of TitanPanelRightClickMenu_AddToggleVar adding a remove button - local info = {}; - info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"]; - info.value = {id, "DisplayOnRightSide"}; - info.func = function() - local bar = TitanUtils_GetWhichBar(id) - TitanPanelRightClickMenu_ToggleVar({id, "DisplayOnRightSide"}) - TitanPanel_RemoveButton(id); - TitanUtils_AddButtonOnBar(bar, id) - end - info.checked = TitanGetVar(id, "DisplayOnRightSide"); - info.keepShownOnClick = 1; - DDM:UIDropDownMenu_AddButton(info, level); -end - ---[[ API NAME: TitanPanelRightClickMenu_AddHide DESC: Menu - add a Hide (localized) command at the given level in the form of a button. When clicked this will remove the plugin from the Titan bar. VAR: id - id of the plugin @@ -941,6 +895,34 @@ function TitanPanelRightClickMenu_ToggleColoredText(value) TitanPanelButton_UpdateButton(value, 1); end +--[[ API +NAME: TitanPanelRightClickMenu_SetCustomBackdrop +DESC: This will set the backdrop of the given button. This is used for custom created controls such as Clock offset or Volume sliders to give a consistent look. +VAR: frame - the control frame of the plugin +OUT: None +--]] +function TitanPanelRightClickMenu_SetCustomBackdrop(frame) + frame:SetBackdrop({ + bgFile="Interface\\Tooltips\\UI-Tooltip-Background", + edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", + tile = true, + tileEdge = true, + insets = { left = 1, right = 1, top = 1, bottom = 1 }, + tileSize = 8, + edgeSize = 8, + }) + + frame:SetBackdropBorderColor( + TOOLTIP_DEFAULT_COLOR.r, + TOOLTIP_DEFAULT_COLOR.g, + TOOLTIP_DEFAULT_COLOR.b); + frame:SetBackdropColor( + TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, + TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, + TOOLTIP_DEFAULT_BACKGROUND_COLOR.b + , 1); +end + -------------------------------------------------------------- -- -- Plugin manipulation routines diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua index 9a63c49..0ff112f 100644 --- a/TitanClock/TitanClock.lua +++ b/TitanClock/TitanClock.lua @@ -10,27 +10,10 @@ local TITAN_CLOCK_FORMAT_12H = "12H"; local TITAN_CLOCK_FORMAT_24H = "24H"; local TITAN_CLOCK_FRAME_SHOW_TIME = 0.5; local _G = getfenv(0); - -local back_drop_info = - { - bgFile="Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - tileSize = 8, - edgeSize = 8, - } - - -- ******************************** Variables ******************************* local L = LibStub("AceLocale-3.0"):GetLocale("Titan", true) local AceTimer = LibStub("AceTimer-3.0") ---local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") +local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") local ClockTimer = nil; local updateTable = {TITAN_CLOCK_ID, TITAN_PANEL_UPDATE_ALL }; local realmName = GetRealmName(); @@ -464,19 +447,9 @@ Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template (XML) and set the values in the code (Lua) -9.5.1 Blizzard decided to remove the backdrop constant we were using... - -Use the Blizzard color defaults. -Leave the background opaque because it is an option not a tooltip. +9.5 The tooltip template was removed from the GameTooltip. --]] - self:SetBackdrop(back_drop_info) - - self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); - self:SetBackdropColor( - TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, - 1); + TitanPanelRightClickMenu_SetCustomBackdrop(self) end -- ************************************************************************** @@ -499,31 +472,31 @@ function TitanPanelRightClickMenu_PrepareClockMenu() info.text = L["TITAN_CLOCK_MENU_LOCAL_TIME"]; info.func = function() TitanSetVar(TITAN_CLOCK_ID, "TimeMode", "Local") TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) end info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Local" end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.text = L["TITAN_CLOCK_MENU_SERVER_TIME"]; info.func = function() TitanSetVar(TITAN_CLOCK_ID, "TimeMode", "Server") TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) end info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Server" end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.text = L["TITAN_CLOCK_MENU_SERVER_ADJUSTED_TIME"]; info.func = function() TitanSetVar(TITAN_CLOCK_ID, "TimeMode", "ServerAdjusted") TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) end info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjusted" end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.text = L["TITAN_CLOCK_MENU_SERVER_TIME"].." & "..L["TITAN_CLOCK_MENU_LOCAL_TIME"] info.func = function() TitanSetVar(TITAN_CLOCK_ID, "TimeMode", "ServerLocal") TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) end info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerLocal" end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.text = L["TITAN_CLOCK_MENU_SERVER_ADJUSTED_TIME"].." & "..L["TITAN_CLOCK_MENU_LOCAL_TIME"] info.func = function() TitanSetVar(TITAN_CLOCK_ID, "TimeMode", "ServerAdjustedLocal") TitanPanelButton_UpdateButton(TITAN_CLOCK_ID) end info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjustedLocal" end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); TitanPanelRightClickMenu_AddSpacer(); @@ -532,20 +505,57 @@ function TitanPanelRightClickMenu_PrepareClockMenu() info.func = TitanPanelClockButton_ToggleMapTime; info.checked = TitanGetVar(TITAN_CLOCK_ID, "HideMapTime"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.text = L["TITAN_CLOCK_MENU_HIDE_CALENDAR"]; info.func = TitanPanelClockButton_ToggleGameTimeFrameShown; info.checked = TitanGetVar(TITAN_CLOCK_ID, "HideGameTimeMinimap"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); + + info = {}; + info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"]; + info.func = TitanPanelClockButton_ToggleRightSideDisplay; + info.checked = TitanGetVar(TITAN_CLOCK_ID, "DisplayOnRightSide"); + DDM:UIDropDownMenu_AddButton(info); - TitanPanelRightClickMenu_AddSpacer(); TitanPanelRightClickMenu_AddToggleLabelText(TITAN_CLOCK_ID); TitanPanelRightClickMenu_AddToggleColoredText(TITAN_CLOCK_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_CLOCK_ID); TitanPanelRightClickMenu_AddSpacer(); TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_CLOCK_ID, TITAN_PANEL_MENU_FUNC_HIDE); end + +-- ************************************************************************** +-- NAME : TitanPanelClockButton_ToggleRightSideDisplay() +-- DESC : Add clock button to bar +-- ************************************************************************** +function TitanPanelClockButton_ToggleRightSideDisplay() + TitanToggleVar(TITAN_CLOCK_ID, "DisplayOnRightSide"); + TitanPanel_RemoveButton(TITAN_CLOCK_ID); + --TitanPanel_AddButton(TITAN_CLOCK_ID); +end + +function TitanPanelClockButton_ToggleGameTimeFrameShown() + TitanToggleVar(TITAN_CLOCK_ID, "HideGameTimeMinimap"); + if GameTimeFrame and GameTimeFrame:GetName() then + if TitanGetVar(TITAN_CLOCK_ID, "HideGameTimeMinimap") then + GameTimeFrame:Hide() + else + GameTimeFrame:Show() + end + end +end + + +function TitanPanelClockButton_ToggleMapTime() + TitanToggleVar(TITAN_CLOCK_ID, "HideMapTime"); + if TimeManagerClockButton and TimeManagerClockButton:GetName() then + if TitanGetVar(TITAN_CLOCK_ID, "HideMapTime") then + TimeManagerClockButton:Hide() + else + TimeManagerClockButton:Show() + end + end +end diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua index 832b651..0dd0dba 100644 --- a/TitanPerformance/TitanPerformance.lua +++ b/TitanPerformance/TitanPerformance.lua @@ -35,7 +35,7 @@ local topAddOns; local memUsageSinceGC = {}; local counter = 1; --counter for active addons local L = LibStub("AceLocale-3.0"):GetLocale("Titan", true) ---local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") +local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") local AceTimer = LibStub("AceTimer-3.0") local PerfTimer = nil; -- ******************************** Functions ******************************* @@ -69,7 +69,7 @@ function TitanPanelPerformanceButton_OnLoad(self) ShowLabelText = true, ShowRegularText = false, ShowColoredText = true, - DisplayOnRightSide = true, + DisplayOnRightSide = false, }, savedVariables = { ShowFPS = 1, @@ -83,7 +83,6 @@ function TitanPanelPerformanceButton_OnLoad(self) ShowIcon = 1, ShowLabelText = false, ShowColoredText = 1, - DisplayOnRightSide = false, } }; @@ -373,9 +372,8 @@ function TitanPanelPerformanceButton_SetTooltip() -- Tooltip title GameTooltip:SetText(L["TITAN_PERFORMANCE_TOOLTIP"], HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); --- Ticket 48 : Request to always show info in the tooltip. Does NOT include addon info as that is tooltip only -- FPS tooltip --- if ( showFPS ) then + if ( showFPS ) then local fpsText = format(L["TITAN_FPS_FORMAT"], button.fps); local avgFPSText = format(L["TITAN_FPS_FORMAT"], button.avgFPS); local minFPSText = format(L["TITAN_FPS_FORMAT"], button.minFPS); @@ -387,10 +385,10 @@ function TitanPanelPerformanceButton_SetTooltip() GameTooltip:AddDoubleLine(L["TITAN_FPS_TOOLTIP_AVG_FPS"], TitanUtils_GetHighlightText(avgFPSText)); GameTooltip:AddDoubleLine(L["TITAN_FPS_TOOLTIP_MIN_FPS"], TitanUtils_GetHighlightText(minFPSText)); GameTooltip:AddDoubleLine(L["TITAN_FPS_TOOLTIP_MAX_FPS"], TitanUtils_GetHighlightText(maxFPSText)); --- end + end -- Latency tooltip --- if ( showLatency or showWorldLatency ) then + if ( showLatency or showWorldLatency ) then local latencyText = format(L["TITAN_LATENCY_FORMAT"], button.latencyHome); local latencyWorldText = format(L["TITAN_LATENCY_FORMAT"], button.latencyWorld); local bandwidthInText = format(L["TITAN_LATENCY_BANDWIDTH_FORMAT"], button.bandwidthIn); @@ -402,10 +400,10 @@ function TitanPanelPerformanceButton_SetTooltip() if showWorldLatency then GameTooltip:AddDoubleLine(L["TITAN_LATENCY_TOOLTIP_LATENCY_WORLD"], TitanUtils_GetHighlightText(latencyWorldText)); end GameTooltip:AddDoubleLine(L["TITAN_LATENCY_TOOLTIP_BANDWIDTH_IN"], TitanUtils_GetHighlightText(bandwidthInText)); GameTooltip:AddDoubleLine(L["TITAN_LATENCY_TOOLTIP_BANDWIDTH_OUT"], TitanUtils_GetHighlightText(bandwidthOutText)); --- end + end -- Memory tooltip --- if ( showMemory ) then + if ( showMemory ) then local memoryText = format(L["TITAN_MEMORY_FORMAT"], button.memory/1024); local initialMemoryText = format(L["TITAN_MEMORY_FORMAT"], button.initialMemory/1024); local sessionTime = time() - button.startSessionTime; @@ -426,7 +424,7 @@ function TitanPanelPerformanceButton_SetTooltip() GameTooltip:AddDoubleLine(L["TITAN_MEMORY_TOOLTIP_CURRENT_MEMORY"], TitanUtils_GetHighlightText(memoryText)); GameTooltip:AddDoubleLine(L["TITAN_MEMORY_TOOLTIP_INITIAL_MEMORY"], TitanUtils_GetHighlightText(initialMemoryText)); GameTooltip:AddDoubleLine(L["TITAN_MEMORY_TOOLTIP_INCREASING_RATE"], rateRichText); --- end + end if ( showAddonMemory == 1 ) then for _,i in pairs(topAddOns) do @@ -466,7 +464,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowFPS"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); local temptable = {TITAN_PERFORMANCE_ID, "ShowLatency"}; info = {}; @@ -477,7 +475,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowLatency"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); local temptable = {TITAN_PERFORMANCE_ID, "ShowWorldLatency"}; info = {}; @@ -488,7 +486,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowWorldLatency"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); local temptable = {TITAN_PERFORMANCE_ID, "ShowMemory"}; info = {}; @@ -499,7 +497,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowMemory"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); end if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "AddonUsage" then @@ -514,7 +512,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonMemory"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); local temptable = {TITAN_PERFORMANCE_ID, "ShowAddonIncRate"}; info = {}; @@ -525,14 +523,14 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() end info.checked = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonIncRate"); info.keepShownOnClick = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); info = {}; info.notCheckable = true info.text = L["TITAN_PERFORMANCE_CONTROL_TOOLTIP"]..LIGHTYELLOW_FONT_COLOR_CODE..tostring(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons")); info.value = "AddonControlFrame" info.hasArrow = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); end if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "AddonMemoryFormat" then @@ -542,13 +540,13 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() info.checked = function() if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 1 then return true else return nil end end info.func = function() TitanSetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType", 1) end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); info = {}; info.text = L["TITAN_MEMORY_KBMB_LABEL"]; info.checked = function() if TitanGetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType") == 2 then return true else return nil end end info.func = function() TitanSetVar(TITAN_PERFORMANCE_ID, "AddonMemoryType", 2) end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); end if _G["L_UIDROPDOWNMENU_MENU_VALUE"] == "CPUProfiling" then @@ -557,13 +555,13 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() info = {}; info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_OFF"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"]; info.func = function() SetCVar("scriptProfile", "0", 1) ReloadUI() end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); else TitanPanelRightClickMenu_AddTitle(L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]..": "..RED_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_DISABLED"], _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); info = {}; info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL_ON"]..GREEN_FONT_COLOR_CODE..L["TITAN_PANEL_MENU_RELOADUI"]; info.func = function() SetCVar("scriptProfile", "1", 1) ReloadUI() end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info, _G["L_UIDROPDOWNMENU_MENU_LEVEL"]); end end return @@ -577,34 +575,33 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() info.text = L["TITAN_PANEL_OPTIONS"]; info.value = "Options" info.hasArrow = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.notCheckable = true info.text = L["TITAN_PERFORMANCE_ADDONS"]; info.value = "AddonUsage" info.hasArrow = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.notCheckable = true info.text = L["TITAN_PERFORMANCE_ADDON_MEM_FORMAT_LABEL"]; info.value = "AddonMemoryFormat" info.hasArrow = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info = {}; info.notCheckable = true info.text = L["TITAN_PERFORMANCE_MENU_CPUPROF_LABEL"]; info.value = "CPUProfiling" info.hasArrow = 1; - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); TitanPanelRightClickMenu_AddSpacer(); TitanPanelRightClickMenu_AddToggleIcon(TITAN_PERFORMANCE_ID); TitanPanelRightClickMenu_AddToggleLabelText(TITAN_PERFORMANCE_ID); TitanPanelRightClickMenu_AddToggleColoredText(TITAN_PERFORMANCE_ID); - TitanPanelRightClickMenu_AddToggleRightSide(TITAN_PERFORMANCE_ID); TitanPanelRightClickMenu_AddSpacer(); TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_PERFORMANCE_ID, TITAN_PANEL_MENU_FUNC_HIDE); end @@ -622,7 +619,7 @@ function TitanPanelPerformanceButton_UpdateData() local showAddonMemory = TitanGetVar(TITAN_PERFORMANCE_ID, "ShowAddonMemory"); -- FPS Data --- if ( showFPS ) then + if ( showFPS ) then button.fps = GetFramerate(); button.fpsSampleCount = button.fpsSampleCount + 1; if (button.fpsSampleCount == 1) then @@ -637,13 +634,13 @@ function TitanPanelPerformanceButton_UpdateData() end button.avgFPS = (button.avgFPS * (button.fpsSampleCount - 1) + button.fps) / button.fpsSampleCount; end --- end + end -- Latency Data --- if ( showLatency or showWorldLatency ) then + if ( showLatency or showWorldLatency ) then -- bandwidthIn, bandwidthOut, latencyHome, latencyWorld = GetNetStats(); button.bandwidthIn, button.bandwidthOut, button.latencyHome, button.latencyWorld = GetNetStats(); --- end + end -- Memory data if ( showMemory ) or (showAddonMemory == 1) then @@ -697,21 +694,6 @@ function TitanPanelPerformanceButton_OnClick(self, button) end end -local back_drop_info = - { - bgFile="Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - tileSize = 8, - edgeSize = 8, - } - -- ************************************************************************** -- NAME : TitanPanelPerfControlSlider_OnEnter() -- DESC : Display tooltip on entering slider @@ -744,12 +726,7 @@ function TitanPanelPerfControlSlider_OnShow(self) self:SetObeyStepOnDrag(true) -- since 5.4.2 (Mists of Pandaria) self:SetValue(CalcAppNum(TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"))); -- self:SetValue((TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"))); - TitanPanelPerfControlFrame:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); - TitanPanelPerfControlFrame:SetBackdropColor( - TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, - 1); +-- TitanPanelPerfControlFrame:SetBackdropColor(0, 0, 0, 1) --[[ TitanDebug("Slider_OnShow:" .." : "..(self:GetValue() or "?") @@ -836,19 +813,9 @@ Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template (XML) and set the values in the code (Lua) -9.5.1 Blizzard decided to remove the backdrop constant we were using... - -Use the Blizzard color defaults. -Leave the background opaque because it is an option not a tooltip. +9.5 The tooltip template was removed from the GameTooltip. --]] - self:SetBackdrop(back_drop_info) - - self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); - self:SetBackdropColor( - TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, - 1); + TitanPanelRightClickMenu_SetCustomBackdrop(self) end -- ************************************************************************** diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua index 6b9ea54..a0e221d 100644 --- a/TitanVolume/TitanVolume.lua +++ b/TitanVolume/TitanVolume.lua @@ -9,22 +9,7 @@ local TITAN_VOLUME_FRAME_SHOW_TIME = 0.5; local TITAN_VOLUME_ARTWORK_PATH = "Interface\\AddOns\\TitanVolume\\Artwork\\"; local _G = getfenv(0); local L = LibStub("AceLocale-3.0"):GetLocale("Titan", true) ---local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") - -local back_drop_info = - { - bgFile="Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - tileSize = 8, - edgeSize = 8, - } +local DDM = LibStub:GetLibrary("LibUIDropDownMenu-4.0") function TitanPanelVolumeButton_OnLoad(self) self.registry = { @@ -77,8 +62,8 @@ function TitanPanelVolumeButton_OnEnter() TitanPanelMusicVolumeControlSlider:SetValue(1 - GetCVar("Sound_MusicVolume")); -- TitanPanelMicrophoneVolumeControlSlider:SetValue(1 - GetCVar("OutboundChatVolume")); -- TitanPanelSpeakerVolumeControlSlider:SetValue(1 - GetCVar("InboundChatVolume")); - TitanPanelVolume_SetVolumeIcon(); - end + TitanPanelVolume_SetVolumeIcon(); +end -- 'Master' function TitanPanelMasterVolumeControlSlider_OnEnter(self) @@ -385,19 +370,9 @@ Blizzard decided to remove direct Backdrop API in 9.0 (Shadowlands) so inherit the template (XML) and set the values in the code (Lua) -9.5.1 Blizzard decided to remove the backdrop constant we were using... - -Use the Blizzard color defaults. -Leave the background opaque because it is an option not a tooltip. +9.5 The tooltip template was removed from the GameTooltip. --]] - self:SetBackdrop(back_drop_info) - - self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 1); - self:SetBackdropColor( - TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, - TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, - 1); + TitanPanelRightClickMenu_SetCustomBackdrop(self) end function TitanPanelVolumeControlFrame_OnUpdate(self, elapsed) @@ -447,7 +422,7 @@ function TitanPanelRightClickMenu_PrepareVolumeMenu() info.func = function() ShowUIPanel(VideoOptionsFrame); end - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); info.text = L["TITAN_VOLUME_MENU_OVERRIDE_BLIZZ_SETTINGS"]; info.notCheckable = false @@ -455,7 +430,7 @@ function TitanPanelRightClickMenu_PrepareVolumeMenu() TitanToggleVar(TITAN_VOLUME_ID, "OverrideBlizzSettings"); end info.checked = TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings"); - TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel()); + DDM:UIDropDownMenu_AddButton(info); TitanPanelRightClickMenu_AddSpacer(); TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_VOLUME_ID, TITAN_PANEL_MENU_FUNC_HIDE); -- 1.7.9.5