From 915b69eec0a1fe8bb6cc481e56f9e2e819610fd0 Mon Sep 17 00:00:00 2001 From: urnati Date: Sat, 10 Jul 2021 22:47:48 -0400 Subject: [PATCH] - Clock change to allow both Server and Local to be displayed. - Fix for #1306 where bottom bar disappears when using bottom bars and enter & leave vehicle and et battles - Fix for zone ability (extra button) going over main menu bar - Fix to actually hide Titan top bars if in class hall --- Titan/TitanConfig.lua | 8 +- Titan/TitanMovable.lua | 374 +++++++++++++++++++-------------------------- Titan/TitanPanel.lua | 64 +++++++- Titan/TitanUtils.lua | 6 + TitanClock/TitanClock.lua | 37 ++++- 5 files changed, 262 insertions(+), 227 deletions(-) diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index e7ef19d..d55b4aa 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -710,7 +710,7 @@ local optionsBars = { get = function() return (TitanPanelGetVar("Bar_Show")) end, set = function() TitanPanelToggleVar("Bar_Show") - TitanPanelBarButton_DisplayBarsWanted() + TitanPanelBarButton_DisplayBarsWanted("Bar_Show "..tostring(TitanPanelGetVar("Bar_Show"))) end, }, optiontophide = { @@ -747,7 +747,7 @@ local optionsBars = { get = function() return TitanPanelGetVar("Bar2_Show") end, set = function() TitanPanelToggleVar("Bar2_Show") - TitanPanelBarButton_DisplayBarsWanted() + TitanPanelBarButton_DisplayBarsWanted("Bar2_Show "..tostring(TitanPanelGetVar("Bar2_Show"))) end, }, optionbottomhide = { @@ -828,7 +828,7 @@ local optionsAuxBars = { get = function() return (TitanPanelGetVar("AuxBar_Show")) end, set = function() TitanPanelToggleVar("AuxBar_Show") - TitanPanelBarButton_DisplayBarsWanted() + TitanPanelBarButton_DisplayBarsWanted("AuxBar_Show "..tostring(TitanPanelGetVar("AuxBar_Show"))) end, }, optiontophide = { @@ -861,7 +861,7 @@ local optionsAuxBars = { get = function() return TitanPanelGetVar("AuxBar2_Show") end, set = function() TitanPanelToggleVar("AuxBar2_Show") - TitanPanelBarButton_DisplayBarsWanted() + TitanPanelBarButton_DisplayBarsWanted("AuxBar2_Show "..tostring(TitanPanelGetVar("AuxBar2_Show"))) end, }, optionbottomhide = { diff --git a/Titan/TitanMovable.lua b/Titan/TitanMovable.lua index 984ff71..3bf5f36 100755 --- a/Titan/TitanMovable.lua +++ b/Titan/TitanMovable.lua @@ -8,6 +8,45 @@ Addons that replace all or parts of the Blizzard UI use this. The user can turn turn on / off the adjusting of all top frames or all bottom frames. :DESC + +NOTE: The Override Bar has changed over time. Titan has had to evolve with it, making several attempts to +create a reasonable fix to minimize the impact to the player. +Titan Panel hooks 3 areas: +- OverrideActionBar show +- OverrideActionBar hide +- ActionBarController_UpdateAll +This covers various quests and other situations that replace the main menu bar temporarily. + +When the player uses bottom bar(s), the bars are hidden while the override is active then +put back when the bar is removed. + +While on some quests where the player is in a vehicle, they could be knocked out of said vehicle. +If Titan shows the bottom bar, the main menu could be unusable. Titan will wait for the player to be out of +combat while in a vehicle. +On some quests (for example, some turtle quests in BfA) it takes seconds for the player to fall out of combat +at the end of the quest. This will cause Titan bars to be delayed before appearing. +:NOTE + +NOTE: Some quests replace the menu bar with an Override Bar which causes Titan Panel +to hide the bottom bar(s). +When the menu bar is active again Titan needs to show the bottom bar(s). +A check is made when : +- Override is hidden (hook) +- Vehicle exit (event) +- Combat over (event) +All three are needed to show bottom bar(s) because the order is not guaranteed. Some quests do not use Override bar. +:NOTE + +NOTE: When the player is in their class hall, Titan will hide the top bars to not conflict with the Class Command Bar. +:NOTE + +NOTE: Vehicle enter and leave have become complicated because a vehicle could be a flight path or a quest. +On vehicle enter Titan closes any Titan menus and states the menu bar as 'user controlled' but does not close bottom bars(s). +Stating 'user controlled' is for quests using a vehicle but does not impact flights. +Closing bottom bars will be done on Override show / ActionBarController_UpdateAll invocation +Closing the bottom bars on flights would be inconsistent and remove player functionality. +:NOTE + --]] -- Globals @@ -17,6 +56,7 @@ local InCombatLockdown = _G.InCombatLockdown; local hooks_done = false; local move_count = 0 + --[[ Titan Declare the Ace routines local AceTimer = LibStub("AceTimer-3.0") @@ -119,10 +159,15 @@ NOTE: --]] function TitanMovable_MenuBar_Disable() if DoAdjust(TITAN_PANEL_PLACE_BOTTOM, false) then ---TitanPrint("TitanMovable_MenuBar_Disable - DoAdjust", "warning") MainMenuBar:SetMovable(true); MainMenuBar:SetUserPlaced(false); end + + if TITAN_PANEL_VARS.debug.movable then + TitanDebug ("_MenuBar_Disable :" + .." likely UNIT_ENTERED_VEHICLE" + ) + end end --[[ Titan @@ -157,26 +202,13 @@ DESC: Get the Y axis offset Titan needs (1 or 2 bars) at the given position - to VAR: framePosition - TITAN_PANEL_PLACE_TOP or TITAN_PANEL_PLACE_BOTTOM OUT: Y axis offset, in pixels NOTE: -- The preferred method to determine the Y offset needed by using TitanUtils_GetBarAnchors(). +- The preferred method to determine the Y offset needed to use TitanUtils_GetBarAnchors() +which provides anchors (frames) for an addon to use. :NOTE --]] function TitanMovable_GetPanelYOffset(framePosition) -- used by other addons --- TitanPanelTopAnchor, TitanPanelBottomAnchor - - -- Both top & bottom are figured out but only the -- requested position is returned ---[[ - local barnum_top = TitanPanelTopAnchor:GetBottom() - local barnum_bot = TitanPanelBottomAnchor:GetTop() - - if framePosition == TITAN_PANEL_PLACE_TOP then - return -barnum_top - elseif framePosition == TITAN_PANEL_PLACE_BOTTOM then - return barnum_bot - 1; - -- no idea why -1 is needed... seems anchoring to bottom is off a pixel - end ---]] local barnum_top = 0 local barnum_bot = 0 -- If user has the top adjust set then determine the @@ -351,7 +383,9 @@ NAME: MoveFrame DESC: Adjust the given frame. Expected are frames where :GetPoint works VAR: frame_ptr - Text string of the frame name VAR: start_y - Any offset due to the specific frame -OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom +VAR: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom +VAR: force - Force the adjust; passed through +OUT: None --]] local function MoveFrame(frame_ptr, start_y, top_bottom, force) local frame = _G[frame_ptr] @@ -362,12 +396,6 @@ local function MoveFrame(frame_ptr, start_y, top_bottom, force) then -- skip this frame else ---[[ -TitanDebug ("MoveFrame :" - .." "..tostring(frame_ptr) - .." y:"..tostring(start_y) - ) ---]] if DoAdjust(top_bottom, force) and frame:IsShown() then local scale = TitanPanelGetVar("Scale") local y = 0 @@ -377,49 +405,14 @@ TitanDebug ("MoveFrame :" -- check for nil which will cause an error if point and relativeTo and relativePoint and xOfs then -- do not care about yOfs -- should be safe... --- frame:ClearAllPoints(); --- frame:SetPoint(point, relativeTo:GetName(), relativePoint, xOfs, y) ---[[ --- if tostring(relativeTo:GetName()) == "UIParent" then - if tostring(frame:GetName()) == "ExtraAbilityContainer" then --- else - TitanDebug ("MoveFrame :" - .." "..tostring(frame:GetName()) - .." point:"..tostring(point) - .." relativeTo:"..tostring(relativeTo:GetName()) - .." relativePoint:"..tostring(relativePoint) - .." xOfs:"..tostring(xOfs) - .." y:"..tostring(y) - .." adj:"..tostring(DoAdjust(top_bottom, force)) - .." tb:"..tostring(top_bottom) - .." f:"..tostring(force) - ) - end ---]] SetPosition(frame, point, relativeTo:GetName(), relativePoint, xOfs, y) else -- do not proceed ---[[ - TitanDebug ("MoveFrame nil :" - .." "..tostring(frame:GetName()) - .."point:"..tostring(point) - .."relativeTo:"..tostring(relativeTo:GetName()) - .."relativePoint:"..tostring(relativePoint) - .."xOfs:"..tostring(xOfs) - ) ---]] end else --[[ Some frames such as the ticket frame may not be visible or even created --]] ---[[ - TitanDebug ("MoveFrame no adj :" - .." "..tostring(frame:GetName()) - .." adj: "..tostring(DoAdjust(top_bottom, force)) - .." shown: "..tostring(frame:IsShown()) - ) ---]] end end end @@ -431,7 +424,9 @@ This is modeled after MoveFrame to keep it similar. Titan sets the IsUserPlaced for the MainMenuBar frame so Titan needs to adjust. VAR: frame_ptr - Text string of the frame name VAR: start_y - Any offset due to the specific frame -OUT: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom +VAR: top_bottom - Frame is at top or bottom, expecting Titan constant for top or bottom +VAR: force - Force the adjust; passed through +OUT: None --]] local function MoveMenuFrame(frame_ptr, start_y, top_bottom, force) local frame = _G[frame_ptr] @@ -461,9 +456,10 @@ NOTE: - This is required because Blizz adjusts the chat frame relative to other frames so some of the Blizz code is copied. - If in combat or if the user has moved the chat frame then no action is taken. - The frame is adjusted in the Y axis only. +- See See FCF_UpdateDockPosition if this is no longer working - This routine may need to change. :NOTE --]] -local function Titan_FCF_UpdateDockPosition() +local function Titan_FCF_UpdateDockPosition() -- See FCF_UpdateDockPosition if not Titan__InitializedPEW or not TitanPanelGetVar("LogAdjust") or TitanPanelGetVar("AuxScreenAdjust") then @@ -478,24 +474,6 @@ local function Titan_FCF_UpdateDockPosition() panelYOffset = panelYOffset + (24 * scale) -- after 3.3.5 an additional adjust was needed. why? idk end ---[[ Blizz code - if _G["DEFAULT_CHAT_FRAME"]:IsUserPlaced() then - if _G["SIMPLE_CHAT"] ~= "1" then return end - end - - local chatOffset = 85 + panelYOffset; - if GetNumShapeshiftForms() > 0 or HasPetUI() or PetHasActionBar() then - if MultiBarBottomLeft:IsVisible() then - chatOffset = chatOffset + 55; - else - chatOffset = chatOffset + 15; - end - elseif MultiBarBottomLeft:IsVisible() then - chatOffset = chatOffset + 15; - end - _G["DEFAULT_CHAT_FRAME"]:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 32, chatOffset); - FCF_DockUpdate(); ---]] if ( DEFAULT_CHAT_FRAME:IsUserPlaced() ) then return; end @@ -558,17 +536,6 @@ local function Titan_ContainerFrames_Relocate() end end -local function has_pet_bar() - local hasPetBar = false - if ( ( PetActionBarFrame and PetActionBarFrame:IsShown() ) or ( StanceBarFrame and StanceBarFrame:IsShown() ) or - ( MultiCastActionBarFrame and MultiCastActionBarFrame:IsShown() ) or ( PossessBarFrame and PossessBarFrame:IsShown() ) or - ( MainMenuBarVehicleLeaveButton and MainMenuBarVehicleLeaveButton:IsShown() ) ) then --- tinsert(yOffsetFrames, "pet"); - hasPetBar = true; - end - return hasPetBar -end - local function calc_bars() -- extra action button local res = 0 local out = "" @@ -612,19 +579,7 @@ local function calc_bars() -- extra action button end res = main + left + pet + stance + cast + poss + vehicle ---[[ -TitanDebug ("calc_bars :" - .." "..tostring(out:GetName()) - .." y: "..tostring(res) - .." m: "..tostring(main) - .." l: "..tostring(left) - .." p: "..tostring(pet) - .." s: "..tostring(stance) - .." c: "..tostring(cast) - .." p: "..tostring(poss) - .." v: "..tostring(vehicle) - ) ---]] + return res end XXZZ_calc_bars = calc_bars @@ -709,9 +664,9 @@ local MData = { -- Only spend cycles if the frame is shown. if ExtraActionBarFrame and ExtraActionBarFrame:IsShown() then - -- Need to calc Y because Y depends on what else is shown - -- The extra action button is calculated from the center of the screen so this needs more effort than the other buttons - --[=[ UIParent + --[=[ + Need to calc Y because Y depends on what else is shown + The extra action button is calculated from the center of the screen so this needs more effort than the other buttons Look at UIParent.lua for logic (UIParent_ManageFramePosition) --]=] local actionBarOffset = 45; @@ -723,48 +678,13 @@ local MData = { local rel_start = UIParent:GetHeight() / 2 -- CENTER of UIParent local yOfs = 0 local yOfs1 = 0 ---[[ - if MainMenuBar and MainMenuBar:IsShown() then - yOfs2 = MainMenuBar:GetTop() -- menuBarTop - end - if (MultiBarBottomLeft and MultiBarBottomLeft:IsShown()) - or (MultiBarBottomRight and MultiBarBottomRight:IsShown()) - then - yOfs2 = MultiBarBottomRight:GetTop() -- actionBarOffset - end - if (has_pet_bar()) - and (MultiBarBottomRight and MultiBarBottomRight:IsShown()) - then - yOfs2 = petBattleTop - end - --(yOfs + start_y) * -1 ---]] yOfs = (rel_start * -1) -- bottom of screen + calc_bars() -- offset of WoW bars shown + start_y -- center of extra action button ---[[ -TitanDebug ("move y :" - .." "..tostring(ExtraActionBarFrame:GetName()) - .." y: "..tostring(yOfs) - .." b/2: "..tostring(start_y) - .." b+: "..tostring(calc_bars()) - .." rs: "..tostring(rel_start) - ) ---]] - --MoveFrame("ExtraActionBarFrame", yOfs, TITAN_PANEL_PLACE_BOTTOM, force) MoveFrame("ExtraAbilityContainer", yOfs, TITAN_PANEL_PLACE_BOTTOM, force) end end, addonAdj = false, }, ---[[ - [8] = {frameName = "OverrideActionBar", - move = function (force) MoveFrame("OverrideActionBar", 0, TITAN_PANEL_PLACE_BOTTOM, force) end, - addonAdj = false, }, - [12] = {frameName = "OrderHallCommandBar", - move = function (force) - MoveFrame("OrderHallCommandBar", 0, TITAN_PANEL_PLACE_TOP, force) end, - addonAdj = false, }, ---]] } --[[ Titan @@ -813,8 +733,8 @@ local function TitanMovableFrame_MoveFrames(force) local str = "" -- debug local force = force or false --[[ - Setting the MainMenuBar as user placed is needed because in 8.0.0 Blizzard changed something in the - way they controlled the frame. With Titan panel and bottom bars enabled the MainMenuBar + Setting the MainMenuBar as user placed is needed because in 8.0.0 because Blizzard changed something in the + way they controlled the frame. With Titan Panel and bottom bars enabled the MainMenuBar would 'bounce'. Figuring out the true root cause was a bust. This idea of user placed came from a Titan user who is an addon developer. However setting user placed causes the main menu bar to not act as we desire due to the way Blizzard coded the bar. @@ -870,17 +790,19 @@ NAME: TitanPanel_AdjustFrames DESC: Adjust the frames for the Titan visible bars. This is a shell for the actual Movable routine used by other Titan routines and secure hooks VAR: force - Force an adjust such as when the user changes bars shown +VAR: reason - Debug to determine where and why an adjust is requested OUT: None NOTE: :NOTE --]] function TitanPanel_AdjustFrames(force, reason) ---[[ -TitanDebug ("_AdjustFrames :" - .." "..tostring(force) - .." reason: '"..tostring(reason).."'" - ) ---]] + if TITAN_PANEL_VARS.debug.movable then + TitanDebug ("_AdjustFrames :" + .." f: "..tostring(force) + .." r: '"..tostring(reason).."'" + ) + end + local f = false -- do not require the parameter if force == true then -- but force it to be boolean f = true @@ -917,12 +839,12 @@ function Titan_AdjustScale() end TitanPanel_AdjustFrames(false, "_AdjustScale ") --- TitanPanelBarButton_DisplayBarsWanted() TitanPanel_RefreshPanelButtons(); end end ---[[ ============= +--[[ Titan +============= NAME: Titan_Hook_* DESC: Set of routines to front the adjust the frames routine. VAR: None @@ -936,8 +858,70 @@ This group of Titan_Hook_* is : These may be called from any Titan Panel code :NOTE --]] -function Titan_Hook_Frames() - TitanPanel_AdjustFrames(false, "Hook UIParent_ManageFramePositions ") + +function Titan_Hook_Frames() -- UIParent_ManageFramePositions hook + --[[ + This is the routine that will be called the most. It is the general purpose routine for WoW frames. + As Blizzard has changed (or in some cases added) ways to handle the various bars it has across expansions, + this routine has had to become more complex. + Especially to handle the main menu bar processing along with override bar which also handles 'in vehicle' bars. + The processing is needed to sometimes handle hiding or delaying Titan bars to not interfere with the normal WoW + bars - top or bottom. + + This can hide top or bottom bars to avoid conflicts visually or functionally with WoW bars. + When a normal adjust is requested, this calls TitanPanelBarButton_DisplayBarsWanted rather than + TitanPanel_AdjustFrames because bars to show bars that may have been hidden in a prior invocation. It is + a touch 'heavy' but will force bars back if hidden for any reason. + --]] +-- TitanPanel_AdjustFrames(false, "Hook UIParent_ManageFramePositions ") + local reason = "Hook UIParent_* - " + --[[ + Code from ActionBarController.lua ActionBarController_UpdateAll modified for Titan + This hook relies on _UpdateAll calling UIParent_ManageFramePositions near the end of its processing + --]] + -- If we have a skinned vehicle bar or skinned override bar, display the OverrideActionBar + if ((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "") + or (HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= 0)) then + reason = reason.."skinned override bar" + -- Override bar in place; hide Titan bottom bar(s) + TitanPanelBarButton_HideBottomBars() + -- If we have a non-skinned override bar of some sort, use the MainMenuBarArtFrame + elseif ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() or C_PetBattles.IsInBattle() ) then + reason = reason.."non-skinned override bar" + -- Override bar in place; hide Titan bottom bar(s) + TitanPanelBarButton_HideBottomBars() + elseif ( OrderHallCommandBar and OrderHallCommandBar:IsShown() ) then + reason = reason.."Order Hall bar" + -- Override bar in place; hide Titan bottom bar(s) + TitanPanelBarButton_HideAllBars() + else + if InCombatLockdown() or UnitVehicleSkin("player") then + reason = reason.."waiting..." + --[[ + wait until out of combat just in case... + Putting back a bar (especially bottom bar) in combat could cause the + main menu bar to not work as expected. + --]] + else + reason = reason.."Adjust" + -- Overkill but bottom bars could have been hidden + TitanPanelBarButton_DisplayBarsWanted("Hook _Frames*") + end + end + + if TITAN_PANEL_VARS.debug.movable then + TitanDebug (tostring(reason) + .." c: "..tostring(InCombatLockdown()) + .." b1: "..tostring(TitanPanelGetVar("AuxBar_Show")) + .." b2: "..tostring(TitanPanelGetVar("AuxBar2_Show")) + .." vb+: "..tostring((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "") and true or false) + .." ob+: "..tostring((HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= 0) and true or false) + .." bb: "..tostring(HasBonusActionBar()) + .." ob: "..tostring(HasOverrideActionBar()) + .." sb: "..tostring(HasTempShapeshiftActionBar()) + .." pb: "..tostring(C_PetBattles.IsInBattle()) + ) + end end function Titan_Hook_Ticket_Show() @@ -952,45 +936,10 @@ function Titan_Hook_Target() TitanPanel_AdjustFrames(false, "Hook TargetFrame_Update ") end ---[[ -function Titan_Hook_Override_Show() - TitanPanel_AdjustFrames(false, "Hook OverrideActionBar Show") -end ---]] - -function Titan_Hook_Override() - -- We need a post hook here... - local bar_state = ActionBarController_GetCurrentActionBarState() - if bar_state == LE_ACTIONBAR_STATE_MAIN then - -- normal state, show / restore the user requested bars - if InCombatLockdown() or UnitInVehicle("player") then - -- wait until out of combat just in case... - -- Putting back a bar (especially bottom bar) could cause the - -- main menu bar to not work as expected. - else - TitanPanelBarButton_DisplayBarsWanted() - end - elseif bar_state == LE_ACTIONBAR_STATE_OVERRIDE then - -- override bar in place, look at bottom bars - if TitanPanelGetVar("AuxBar_Show") then - TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar") - end - if TitanPanelGetVar("AuxBar2_Show") then - TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2") - end - else - -- no other known states - end -end - function Titan_Hook_Map() TitanPanel_AdjustFrames(false, "Hook WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton ") end -function Titan_Hook_OrderHall() - TitanPanel_AdjustFrames(false, "Hook OrderHall_CheckCommandBar ") -end - function Titan_Hook_PEW() TitanPanel_AdjustFrames(false, "Hook PEW Config timer") end @@ -999,11 +948,11 @@ function Titan_Hook_SpecSwitch() TitanPanel_AdjustFrames(false, "Hook SpecSwitch Config timer ") end -function Titan_Hook_MoveAdj() +function Titan_Hook_MoveAdj() -- in config but not used TitanPanel_AdjustFrames(false, "Hook MoveAdj Config timer ") end -function Titan_Hook_Vehicle() +function Titan_Hook_Vehicle() -- in config but not used TitanPanel_AdjustFrames(false, "Hook Vehicle Config timer ") end @@ -1032,32 +981,20 @@ function TitanMovable_SecureFrames() TitanPanelAce:SecureHook(TicketStatusFrame, "Show", Titan_Hook_Ticket_Show) -- HelpFrame.xml TitanPanelAce:SecureHook(TicketStatusFrame, "Hide", Titan_Hook_Ticket_Hide) -- HelpFrame.xml TitanPanelAce:SecureHook("TargetFrame_Update", Titan_Hook_Target) -- TargetFrame.lua --- TitanPanelAce:SecureHook(OverrideActionBar, "Show", Titan_Hook_Override_Show) -- HelpFrame.xml --- TitanPanelAce:SecureHook(OverrideActionBar, "Hide", Titan_Hook_Override_Hide) -- HelpFrame.xml TitanPanelAce:SecureHook("UpdateContainerFrameAnchors", Titan_ContainerFrames_Relocate) -- ContainerFrame.lua TitanPanelAce:SecureHook(WorldMapFrame.BorderFrame.MaximizeMinimizeFrame.MinimizeButton, "Show", Titan_Hook_Map) -- WorldMapFrame.lua - TitanPanelAce:SecureHook("OrderHall_CheckCommandBar", Titan_Hook_OrderHall) +-- TitanPanelAce:SecureHook("OrderHall_CheckCommandBar", Titan_Hook_OrderHall) end - -- Updated fix for change to Override Bar which allows a player to be knocked off a 'vehicle' while in - -- combat. This can cause Titan bottom bar to cover the main menu bar. - --[[ From ActionBarController.lua - Slight kludge to build the frame name here, they are used in TitanVariables to define each bar - --]] - - if TitanPanelAce:IsHooked("ActionBarController_UpdateAll", Titan_Hook_Override) then - -- nothing to do - else - TitanPanelAce:SecureHook("ActionBarController_UpdateAll", Titan_Hook_Override) - end - if not TitanPanelAce:IsHooked("VideoOptionsFrameOkay_OnClick", Titan_AdjustUIScale) then - -- Properly Adjust UI Scale if set - -- Note: These are the least intrusive hooks we could think of, to properly adjust the Titan Bar(s) - -- without having to resort to a SetCvar secure hook. Any addon using SetCvar should make sure to use the 3rd - -- argument in the API call and trigger the CVAR_UPDATE event with an appropriate argument so that other addons - -- can detect this behavior and fire their own functions (where applicable). + --[[ + Properly Adjust UI Scale if set + Note: These are the least intrusive hooks we could think of, to properly adjust the Titan Bar(s) + without having to resort to a SetCvar secure hook. Any addon using SetCvar should make sure to use the 3rd + argument in the API call and trigger the CVAR_UPDATE event with an appropriate argument so that other addons + can detect this behavior and fire their own functions (where applicable). + --]] TitanPanelAce:SecureHook("VideoOptionsFrameOkay_OnClick", Titan_AdjustUIScale) -- VideoOptionsFrame.lua TitanPanelAce:SecureHook(VideoOptionsFrame, "Hide", Titan_AdjustUIScale) -- VideoOptionsFrame.xml end @@ -1067,9 +1004,18 @@ function TitanMovable_SecureFrames() hooks_done = true end -function TitanMovable_Unhook_SecureFrames() + --[[ -This is a debug attempt to fix an issue when a player is dumped from a vehicle while still in combat. ---]] - TitanPanelAce:UnhookAll() -end + TitanDebug ("MoveFrame :" + .." "..tostring(frame:GetName()) + .." point:"..tostring(point) + .." relativeTo:"..tostring(relativeTo:GetName()) + .." relativePoint:"..tostring(relativePoint) + .." xOfs:"..tostring(xOfs) + .." y:"..tostring(y) + .." adj:"..tostring(DoAdjust(top_bottom, force)) + .." tb:"..tostring(top_bottom) + .." f:"..tostring(force) + ) + end +--]] \ No newline at end of file diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua index 387b63f..08f467a 100644 --- a/Titan/TitanPanel.lua +++ b/Titan/TitanPanel.lua @@ -525,8 +525,20 @@ function TitanPanelBarButton:PLAYER_REGEN_DISABLED() end function TitanPanelBarButton:PLAYER_REGEN_ENABLED() - -- Outside combat check to see if frames need correction - TitanPanel_AdjustFrames(true, "Regen enabled") + --[[ + - Outside combat check to see if frames need correction + - Note: Quests can replace the main menu bar which hides Titan bottom bar(s)... + On completion / exit these may enable regen AFTER exiting the vehicle. + --]] +TitanDebug ("PLAYER_REGEN_ENABLED" +.." c: "..tostring(InCombatLockdown()) +.." v: "..tostring(UnitInVehicle("player")) +) + if InCombatLockdown() or UnitInVehicle("player") then + -- Wait for both to clear + else + TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_ENABLED") + end end --[ function TitanPanelBarButton:ACTIVE_TALENT_GROUP_CHANGED() @@ -539,10 +551,27 @@ function TitanPanelBarButton:UNIT_ENTERED_VEHICLE(self, ...) -- Needed because 8.0 made changes to the menu bar processing (see TitanMovable) TitanMovable_MenuBar_Disable() + --[[ + NOTE: Hiding the Titan bottom bars is not desired here. We cannot (I do not know how :)) + distinguish between a player on a quest or on flight path. + --]] end function TitanPanelBarButton:UNIT_EXITED_VEHICLE(self, ...) - -- A combat check will be done inside the adjust - TitanPanel_AdjustFrames(true, "Exit vehicle") + --[[ + - Note: Some quests replace the menu bar which cause Titan Panel to hide + bottom bar(s). So we need to be certain to make them appear again. + - A combat check will be done inside the adjust which may + FAIL because a regen enabled may come after this event. + --]] +TitanDebug ("UNIT_EXITED_VEHICLE" +.." c: "..tostring(InCombatLockdown()) +.." v: "..tostring(UnitInVehicle("player")) +) + if InCombatLockdown() or UnitInVehicle("player") then + -- Wait for both to clear + else + TitanPanelBarButton_DisplayBarsWanted("UNIT_EXITED_VEHICLE") + end end --]] -- @@ -553,7 +582,7 @@ function TitanPanelBarButton:PET_BATTLE_OPENING_START() end function TitanPanelBarButton:PET_BATTLE_CLOSE() -- A combat check will be done inside the adjust - TitanPanelBarButton_DisplayBarsWanted() + TitanPanelBarButton_DisplayBarsWanted("PET_BATTLE_CLOSE") end -- -- @@ -1229,7 +1258,7 @@ DESC: Show all the Titan bars the user has selected. VAR: None OUT: None --]] -function TitanPanelBarButton_DisplayBarsWanted() +function TitanPanelBarButton_DisplayBarsWanted(reason) -- Check all bars to see if the user has requested they be shown for idx,v in pairs (TitanBarData) do -- Show / hide plus kick auto hide, if needed @@ -1240,7 +1269,7 @@ function TitanPanelBarButton_DisplayBarsWanted() TitanAnchors() -- Adjust other frames because the bars shown / hidden may have changed - TitanPanel_AdjustFrames(true, "_DisplayBarsWanted") + TitanPanel_AdjustFrames(true, reason) end --[[ Titan @@ -1278,6 +1307,25 @@ TitanDebug("_HideAllBars: " end --[[ Titan +NAME: TitanPanelBarButton_HideBottomBars +DESC: This routine will hide the bottom Titan bars (and hiders) regardless of what the user has selected. +VAR: None +OUT: None +NOTE: +- For example when the override bar is being used +- We only need to hide the bars (and hiders) - not adjust frames +:NOTE +--]] +function TitanPanelBarButton_HideBottomBars() + if TitanPanelGetVar("AuxBar_Show") then + TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar") + end + if TitanPanelGetVar("AuxBar2_Show") then + TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2") + end +end + +--[[ Titan NAME: TitanPanelBarButton_Show DESC: Show / hide the given Titan bar based on the user selection. VAR: frame - expected to be a Titan bar name (string) @@ -1423,7 +1471,7 @@ function TitanPanel_InitPanelButtons() } end -- - TitanPanelBarButton_DisplayBarsWanted(); + TitanPanelBarButton_DisplayBarsWanted("TitanPanel_InitPanelButtons"); -- Position all the buttons for i = 1, table.maxn(TitanPanelSettings.Buttons) do diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 24b9633..4f9b37b 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -12,6 +12,12 @@ TITAN_NOT_REGISTERED = _G["RED_FONT_COLOR_CODE"].."Not_Registered_Yet".._G["FONT TITAN_REGISTERED = _G["GREEN_FONT_COLOR_CODE"].."Registered".._G["FONT_COLOR_CODE_CLOSE"] TITAN_REGISTER_FAILED = _G["RED_FONT_COLOR_CODE"].."Failed_to_Register".._G["FONT_COLOR_CODE_CLOSE"] +-- For debug across Titan Panel +TITAN_PANEL_VARS = {} +TITAN_PANEL_VARS.debug = {} +TITAN_PANEL_VARS.debug.movable = false +TITAN_PANEL_VARS.debug.events = false + local _G = getfenv(0); local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) local media = LibStub("LibSharedMedia-3.0") diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua index db669f0..3026482 100644 --- a/TitanClock/TitanClock.lua +++ b/TitanClock/TitanClock.lua @@ -119,6 +119,8 @@ end function TitanPanelClockButton_GetButtonText() local clocktime = ""; local labeltext = ""; + local clocktime2 = nil; + local labeltext2 = nil; local _ = nil if TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Server" then _,clocktime = TitanPanelClockButton_GetTime("Server", 0) @@ -129,8 +131,29 @@ function TitanPanelClockButton_GetButtonText() elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Local" then _,clocktime = TitanPanelClockButton_GetTime ("Local", 0) labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(L) ") or "" + elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerLocal" then + local _, s = TitanPanelClockButton_GetTime ("Server", 0) + local _, l = TitanPanelClockButton_GetTime ("Local", 0) + sl = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(S) ") or "" + ll = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(L) ") or "" + clocktime = s + labeltext = sl + clocktime2 = l + labeltext2 = ll + elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjustedLocal" then + local _, s = TitanPanelClockButton_GetTime ("Server", TitanGetVar(TITAN_CLOCK_ID, "OffsetHour")) + local _, l = TitanPanelClockButton_GetTime ("Local", 0) + sl = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(A) ") or "" + ll = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(L) ") or "" + clocktime = s + labeltext = sl + clocktime2 = l + labeltext2 = ll + elseif TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "Local" then + _,clocktime = TitanPanelClockButton_GetTime ("Local", 0) + labeltext = TitanGetVar(TITAN_CLOCK_ID, "ShowLabelText") and TitanPanelClockButton_GetColored("(L) ") or "" end - return labeltext, clocktime + return labeltext, clocktime, labeltext2, clocktime2 end @@ -464,6 +487,18 @@ function TitanPanelRightClickMenu_PrepareClockMenu() info.checked = function() return TitanGetVar(TITAN_CLOCK_ID, "TimeMode") == "ServerAdjusted" end 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 + 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 + DDM:UIDropDownMenu_AddButton(info); + TitanPanelRightClickMenu_AddSpacer(); info = {}; -- 1.7.9.5