diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 20c8a4c..50dffe8 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -1428,8 +1428,8 @@ print("Color new:"
name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"],
desc = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"],
order = 105, type = "toggle", width = "full",
- get = function() return TitanPanelGetVar("UseGlobal_HideInCombat") end,
- set = function() TitanPanelToggleVar("UseGlobal_HideInCombat"); end,
+ get = function() return TitanPanelGetVar("HideBarsInCombat") end,
+ set = function() TitanPanelToggleVar("HideBarsInCombat"); end,
},
arenaspacer = { -- spacer
order = 200, type = "description", width = "full",
@@ -1444,8 +1444,12 @@ print("Color new:"
name = HIDE, --L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"],
desc = "Hide in Battleground or Arena", --L["TITAN_PANEL_MENU_HIDE_IN_COMBAT_DESC"],
order = 205, type = "toggle", width = "full",
- get = function() return TitanPanelGetVar("HideTopBars") end,
- set = function() TitanPanelToggleVar("HideTopBars"); end,
+ get = function() return TitanPanelGetVar("HideBarsInPVP") end,
+ set = function()
+ TitanPanelToggleVar("HideBarsInPVP")
+ TitanPanelBarButton_DisplayBarsWanted("HideBarsInPVP"
+ .." "..tostring(TitanPanelGetVar("HideBarsInPVP")))
+ end,
},
}
}
diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua
index 691ea30..317406a 100644
--- a/Titan/TitanPanel.lua
+++ b/Titan/TitanPanel.lua
@@ -553,34 +553,15 @@ function TitanPanelBarButton:PET_BATTLE_CLOSE()
TitanPanelBarButton_DisplayBarsWanted("PET_BATTLE_CLOSE")
end
+local in_combat = false -- seems InCombatLockdown may not be set fast enough to reliably hide bars...
function TitanPanelBarButton:PLAYER_REGEN_ENABLED()
+ in_combat = false
TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_ENABLED")
---[===[
- for idx,v in pairs (TitanBarData) do
- if TitanBarDataVars[idx].show then
--- if TitanPanelGetVar(v.name.."_Show") then
- if TitanBarDataVars[idx].hide_in_combat -- TitanPanelGetVar(v.name.."_HideInCombat")
- or TitanPanelGetVar("UseGlobal_HideInCombat") then
- TitanPanelBarButton_Show(idx)
- end
- end
- end
---]===]
end
function TitanPanelBarButton:PLAYER_REGEN_DISABLED()
+ in_combat = true
TitanPanelBarButton_DisplayBarsWanted("PLAYER_REGEN_DISABLED")
---[===[
- for idx,v in pairs (TitanBarData) do
- if TitanBarDataVars[idx].show then
--- if TitanPanelGetVar(v.name.."_Show") then
- if TitanBarDataVars[idx].hide_in_combat -- TitanPanelGetVar(v.name.."_HideInCombat")
- or TitanPanelGetVar("UseGlobal_HideInCombat") then
- TitanPanelBarButton_Hide(idx)
- end
- end
- end
---]===]
end
--
@@ -1290,10 +1271,11 @@ local function showBar(frame_str)
or frame_str == TITAN_PANEL_DISPLAY_PREFIX.."Bar2"
then
-- ===== Battleground or Arena : User selected
- if (TitanPanelGetVar("HideTopBars") == true)
+ if (TitanPanelGetVar("HideBarsInPVP"))
and (C_PvP.IsBattleground()
or C_PvP.IsArena()
- -- or GetZoneText() == "Stormwind City"
+-- or GetZoneText() == "Stormwind City"
+-- or GetZoneText() == "Tempest Keep"
)
then
flag = false
@@ -1307,10 +1289,16 @@ local function showBar(frame_str)
-- ===== In Combat : User selected
if TitanBarDataVars[frame_str].hide_in_combat
- or TitanPanelGetVar("UseGlobal_HideInCombat") then
- flag = false
+ or TitanPanelGetVar("HideBarsInCombat") then
+ if in_combat then -- InCombatLockdown() too slow
+ flag = false
+ end
end
-
+--[[
+print("showBar"
+.." > "..tostring(flag)..""
+)
+--]]
return flag
end
diff --git a/Titan/TitanPanelTemplate.lua b/Titan/TitanPanelTemplate.lua
index 8019499..e4765a3 100644
--- a/Titan/TitanPanelTemplate.lua
+++ b/Titan/TitanPanelTemplate.lua
@@ -181,7 +181,7 @@ print(">>CheckBounds"
end
--[===[
----[[
+--[[
print(">>CheckBounds"
.." '"..tostring(bar_name).."'"
.." '"..tostring(res).."'"
@@ -202,7 +202,7 @@ print(">>CheckBounds"
--]]
--]===]
--- TitanVariables_SetBarPos(self, false, x_off, y_off, w_off)
+ TitanVariables_SetBarPos(self, false, x_off, y_off, w_off)
else
-- Controlled with anchor points; cannot move so no check is needed
end
@@ -276,8 +276,8 @@ print("OnMovingStop"
if res.ok then
else
end
- -- Seems overkill - this will recalc all bars but recalc of textures could be needed...
- TitanPanel_InitPanelBarButton("Check bounds")
+ -- Seems overkill - this will recalc all bars...
+ TitanPanel_InitPanelBarButton("OnMovingStop")
end
local function OnMouseWheel(self, d)
@@ -295,7 +295,7 @@ print("wheel"
)
--]]
-- Seems overkill - this will recalc all bars but recalc of textures could be needed...
- TitanPanel_InitPanelBarButton("Check bounds")
+ TitanPanel_InitPanelBarButton("OnMouseWheel")
end
end
@@ -1442,7 +1442,7 @@ function TitanPanel_InitPanelBarButton()
TitanPanel_SetScale();
for idx,v in pairs (TitanBarData) do
- CheckBarBounds(_G[idx], 0)
+-- CheckBarBounds(_G[idx], 0)
TitanPanel_SetBarTexture(idx)
end
diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua
index dae37bb..157ed7a 100644
--- a/Titan/TitanVariables.lua
+++ b/Titan/TitanVariables.lua
@@ -3,26 +3,32 @@ NAME: TitanVariables.lua
DESC: This file contains the routines to initialize, get, and set the basic data structures used by Titan.
It also sets the global variables and constants used by Titan.
+TitanBarData ^^: Titan static bar reference and placement info
TitanAll is used for settings used for Titan itself such as use global profile, tootip modifier, etc.
TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat are the structures saved to disk (listed in toc).
-TitanSettings: is the table that holds the Titan variables by character and the plugins used by that character.
-TitanSkins: holds the list of Titan and custom skins available to the user.
+TitanSettings : is the table that holds the Titan variables by character and the plugins used by that character.
+TitanSkins : holds the list of Titan and custom skins available to the user.
It is assumed that the skins are in the proper folder on the hard drive. Blizzard does not allow addons to access the disk.
ServerTimeOffsets and ServerHourFormat: are the tables that hold the user selected hour offset and display format per realm (server).
-TitanSettings has 4 major sections with associated shortcuts in the code
+
+TitanSettings has major sections with associated shortcuts in the code
TitanPlayerSettings = TitanSettings.Players[toon]
TitanPluginSettings = TitanSettings.Players[toon].Plugins : Successful registered plugins with all flags
TitanPanelSettings = TitanSettings.Players[toon].Panel : **
TitanPanelRegister = TitanSettings.Players[toon].Register : .registry of all plugins (Titan and LDB) to be registered with Titan
-TitanBarData = TitanSettings.Players[toon].BarData : Titan bar reference and placement info
+TitanBarDataVars ^^= TitanSettings.Players[toon].BarVars : Titan user selected placement info
** :
- Has Plugin placement data under Location and Buttons
- Bar settings Show / Hide, transparency, skins, etc
- Per character Titan settings plugin spacing, global skin, etc
+
+^^ :
+- The index is the string name of the Titan Bar to coordinate staic and user selected bar data
:DESC
--]]
+
local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
local _G = getfenv(0);
local media = LibStub("LibSharedMedia-3.0")
@@ -524,6 +530,8 @@ TITAN_PANEL_SAVED_VARIABLES = {
VersionShown = 1,
ToolTipsShown = 1,
HideTipsInCombat = false,
+ HideBarsInCombat = false,
+ HideBarsInPVP = false,
-- for the independent bars
Bar_Show = true,
Bar_Hide = false,
@@ -834,12 +842,16 @@ NOTE:
:NOTE
--]]
function TitanVariables_InitTitanSettings()
+ local trace = false
local new_toon = false
local player = TitanUtils_GetPlayer()
if (TitanSettings) then
-- all is good
else
TitanSettings = {}
+ if trace then
+ TitanDebug("TitanSettings {}")
+ end
end
-- check for player list per issue #745
@@ -847,12 +859,18 @@ function TitanVariables_InitTitanSettings()
-- all is good
else
TitanSettings.Players = {} -- empty saved vars. New install or wipe
+ if trace then
+ TitanDebug("TitanSettings.Players {}")
+ end
end
if TitanSettings.Players[player] then
-- all is good
else
-- Create the bare player tables so profile(s) can be added
+ if trace then
+ TitanDebug("TitanSettings.Players[] {}")
+ end
TitanSettings.Players[player] = {}
TitanSettings.Players[player].Plugins = {}
TitanSettings.Players[player].Panel = TITAN_PANEL_SAVED_VARIABLES
@@ -872,6 +890,9 @@ function TitanVariables_InitTitanSettings()
else
-- Set to defaults
TitanSettings.Players[player].BarVars = TitanBarVarsDefaults
+ if trace then
+ TitanDebug("TitanSettings.Players[].BarVars Default")
+ end
end
-- Set global variables
@@ -892,8 +913,12 @@ TitanDumpPlayerList()
--]]
if (TitanAll) then
+ -- All good
else
TitanAll = TITAN_ALL_SAVED_VARIABLES
+ if trace then
+ TitanDebug("TitanAll Default")
+ end
end
TitanSettings.Version = TITAN_VERSION;
@@ -1027,9 +1052,8 @@ TitanDebug("_UseSettings "
-- The requested profile at least exists so we can copy to it
-- Copy from the from_profile to profile - not anything in saved vars
-- Get the bar data settings
--- TitanBarPositions = Get_Saved_BarData(from_profile)
- if from_profile and TitanSettings.Players[from_profile] then
+ if from_profile and TitanSettings.Players[from_profile]["BarVars"] then
old_player = TitanSettings.Players[from_profile]
else
end
@@ -1039,10 +1063,18 @@ TitanDebug("_UseSettings "
if old_player and old_player["Plugins"] then
old_plugins = old_player["Plugins"]
end
- -- Copy Bar data
+ -- Copy Bar data to this profile
if old_player and old_player["BarVars"] then
- TitanBarDataVars = deepcopy(old_player["BarVars"])
+ TitanSettings.Players[to_profile]["BarVars"] = deepcopy(old_player["BarVars"])
+ end
+ -- Adjust pointer
+ TitanBarDataVars = TitanSettings.Players[to_profile]["BarVars"]
+
+ -- Apply the new bar positions
+ for idx, v in pairs (TitanBarData) do
+ TitanPanelButton_ApplyBarPos(idx)
end
+
-- Copy the panel settings
for index, id in pairs(old_panel) do
TitanPanelSetVar(index, old_panel[index]);
@@ -1297,6 +1329,13 @@ function TitanVariables_SetPanelStrata(value)
-- Set all the Titan bars
for idx,v in pairs (TitanBarData) do
local bar_name = TITAN_PANEL_DISPLAY_PREFIX..TitanBarData[idx].name
+--[[
+print("Strata"
+.." "..tostring(value).." "
+.." "..tostring(bar_name).." "
+.." "..tostring(bars).." "
+)
+--]]
_G[bar_name]:SetFrameStrata(bars)
end
-- Set all the registered plugins