Quantcast

- Comment control frame routines

urnati [04-30-23 - 13:50]
- Comment control frame routines
- Move a couple unused routines to depracated (commented out at bottom) in prep to delete.
Filename
Titan/TitanUtils.lua
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index 2154bff..66c53e3 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -47,52 +47,6 @@ function TitanUtils_GetBarAnchors() -- Used by addons
 	return TitanPanelTopAnchor, TitanPanelBottomAnchor
 end

---[[ API
-NAME: TitanUtils_GetMinimapAdjust
-DESC: Return the current setting of the Titan MinimapAdjust option.
-VAR: None
-OUT: The value of the MinimapAdjust option
-NOTE:
--  As of DragonFlight Titan Loc no longer adjusts or manipulates the minimap.
---]]
-function TitanUtils_GetMinimapAdjust() -- Used by addons
---	return not TitanPanelGetVar("MinimapAdjust")
-	return false
-end
-
---[[ API
-NAME: TitanUtils_SetMinimapAdjust
-DESC: Set the current setting of the Titan MinimapAdjust option.
-VAR:  bool - true (off) or false (on)
-OUT:  None
-NOTE:
--  As of DragonFlight Titan Loc no longer adjusts or manipulates the minimap.
---]]
-function TitanUtils_SetMinimapAdjust(bool) -- Used by addons
-	-- This routine allows an addon to turn on or off
-	-- the Titan minimap adjust.
---	TitanPanelSetVar("MinimapAdjust", not bool)
-end
-
---[[ API
-NAME: TitanUtils_AddonAdjust
-DESC: Tell Titan to adjust (or not) a frame.
-VAR: frame - is the name (string) of the frame
-VAR: bool  - true if the addon will adjust the frame or false if Titan will adjust
-OUT:  None
-Note:
--- As of DragonFlight, this is no longer needed. The Titan user can user place - or not - a couple frames not user placeable,
-
-- Titan will NOT store the adjust value across a log out / exit.
-- This is a generic way for an addon to tell Titan to not adjust a frame. The addon will take responsibility for adjusting that frame. This is useful for UI style addons so the user can run Titan and a modifed UI.
-- The list of frames Titan adjusts is specified in TitanMovableData within TitanMovable.lua.
-- If the frame name is not in TitanMovableData then Titan does not adjust that frame.
-:NOTE
---]]
-function TitanUtils_AddonAdjust(frame, bool) -- Used by addons
---	TitanMovable_AddonAdjust(frame, bool)
-end
-
 --------------------------------------------------------------
 --
 -- Plugin button search & manipulation routines
@@ -1251,8 +1205,16 @@ end

 --------------------------------------------------------------
 --
--- Frame check & manipulation routines
+-- Control Frame check & manipulation routines
 --
+--[[ Titan Plugins
+NAME: TitanUtils_CheckFrameCounting
+DESC: Check the frame - expected to be a control / menu frame. Close if timer has expired. Used in plugin OnUpdate
+VAR:
+- frame - control / menu frame
+- elapsed - portion of second since last OnUpdate
+OUT:  None
+--]]
 function TitanUtils_CheckFrameCounting(frame, elapsed)
 	if (frame:IsVisible()) then
 		if (not frame.frameTimer or not frame.isCounting) then
@@ -1267,15 +1229,36 @@ function TitanUtils_CheckFrameCounting(frame, elapsed)
 	end
 end

+--[[ Titan Plugins
+NAME: TitanUtils_StartFrameCounting
+DESC: Set the max time the control frame could be open once cursor has left frame. Used in plugin OnLeave
+VAR:
+- frame - control / menu frame
+- frameShowTime - max time
+OUT:  None
+--]]
 function TitanUtils_StartFrameCounting(frame, frameShowTime)
 	frame.frameTimer = frameShowTime;
 	frame.isCounting = 1;
 end

+--[[ Titan Plugins
+NAME: TitanUtils_StopFrameCounting
+DESC: Remove timer flag once cursor has entered frame. Used in plugin OnEnter
+VAR:
+- frame - control / menu frame
+OUT:  None
+--]]
 function TitanUtils_StopFrameCounting(frame)
 	frame.isCounting = nil;
 end

+--[[ Titan Plugins AND Titan
+NAME: TitanUtils_CloseAllControlFrames
+DESC: Remove all timer flags on plugin control frames. Used for plugin Shift+Left and within Titan
+VAR:  None
+OUT:  None
+--]]
 function TitanUtils_CloseAllControlFrames()
 	for index, value in pairs(TitanPlugins) do
 		local frame = _G["TitanPanel"..index.."ControlFrame"];
@@ -1285,16 +1268,13 @@ function TitanUtils_CloseAllControlFrames()
 	end
 end

-function TitanUtils_IsAnyControlFrameVisible() -- need?
-	for index, value in TitanPlugins do
-		local frame = _G["TitanPanel"..index.."ControlFrame"];
-		if (frame:IsVisible()) then
-			return true;
-		end
-	end
-	return false;
-end
-
+--[[ Titan Plugins AND Titan
+NAME: TitanUtils_GetOffscreen
+DESC: Check where the control frame should be on screen; return x and y
+VAR:  None
+OUT: float - x where frame should be
+OUT: float - y where frame should be
+--]]
 function TitanUtils_GetOffscreen(frame)
 	local offscreenX, offscreenY;
 	local ui_scale = UIParent:GetEffectiveScale()
@@ -2195,6 +2175,61 @@ end
 -- Deprecated routines
 -- These routines will be commented out for a couple releases then deleted.
 --
---[[
+--[===[
+--[[ API
+NAME: TitanUtils_GetMinimapAdjust
+DESC: Return the current setting of the Titan MinimapAdjust option.
+VAR: None
+OUT: The value of the MinimapAdjust option
+NOTE:
+-  As of DragonFlight Titan Loc no longer adjusts or manipulates the minimap.
+--]]
+function TitanUtils_GetMinimapAdjust() -- Used by addons
+--	return not TitanPanelGetVar("MinimapAdjust")
+	return false
+end
+
+--[[ API
+NAME: TitanUtils_SetMinimapAdjust
+DESC: Set the current setting of the Titan MinimapAdjust option.
+VAR:  bool - true (off) or false (on)
+OUT:  None
+NOTE:
+-  As of DragonFlight Titan Loc no longer adjusts or manipulates the minimap.
+--]]
+function TitanUtils_SetMinimapAdjust(bool) -- Used by addons
+	-- This routine allows an addon to turn on or off
+	-- the Titan minimap adjust.
+--	TitanPanelSetVar("MinimapAdjust", not bool)
+end
+
+--[[ API
+NAME: TitanUtils_AddonAdjust
+DESC: Tell Titan to adjust (or not) a frame.
+VAR: frame - is the name (string) of the frame
+VAR: bool  - true if the addon will adjust the frame or false if Titan will adjust
+OUT:  None
+Note:
+-- As of DragonFlight, this is no longer needed. The Titan user can user place - or not - a couple frames not user placeable,

+- Titan will NOT store the adjust value across a log out / exit.
+- This is a generic way for an addon to tell Titan to not adjust a frame. The addon will take responsibility for adjusting that frame. This is useful for UI style addons so the user can run Titan and a modifed UI.
+- The list of frames Titan adjusts is specified in TitanMovableData within TitanMovable.lua.
+- If the frame name is not in TitanMovableData then Titan does not adjust that frame.
+:NOTE
 --]]
+function TitanUtils_AddonAdjust(frame, bool) -- Used by addons
+--	TitanMovable_AddonAdjust(frame, bool)
+end
+
+function TitanUtils_IsAnyControlFrameVisible() -- need?
+	for index, value in TitanPlugins do
+		local frame = _G["TitanPanel"..index.."ControlFrame"];
+		if (frame:IsVisible()) then
+			return true;
+		end
+	end
+	return false;
+end
+
+--]===]