From da203a16ae731e05ddc9eeec9b9bf4c07203ca83 Mon Sep 17 00:00:00 2001 From: urnati Date: Sun, 21 Nov 2021 08:17:30 -0500 Subject: [PATCH] - Fix Utils: an older version was accidentily committed - Performance: Add R side option --- Titan/TitanUtils.lua | 46 +++++++++++++++++++++++++++++++++ TitanPerformance/TitanPerformance.lua | 2 ++ 2 files changed, 48 insertions(+) diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 8150fd0..c31c6f3 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -696,6 +696,52 @@ 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_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_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_AddTitle DESC: Menu - add a title at the given level in the form of a button. VAR: title - text to show diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua index 0dd0dba..2db4a39 100644 --- a/TitanPerformance/TitanPerformance.lua +++ b/TitanPerformance/TitanPerformance.lua @@ -83,6 +83,7 @@ function TitanPanelPerformanceButton_OnLoad(self) ShowIcon = 1, ShowLabelText = false, ShowColoredText = 1, + DisplayOnRightSide = false, } }; @@ -602,6 +603,7 @@ function TitanPanelRightClickMenu_PreparePerformanceMenu() 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 -- 1.7.9.5