Quantcast

- Move init of the Bar position saved variables as late as practical - until we need to pick the profile. This avoids some of the catch-22 of trying to set the Bars in place too early.\

urnati [04-26-23 - 02:13]
- Move init of the Bar position saved variables as late as practical - until we need to pick the profile. This avoids some of the catch-22 of trying to set the Bars in place too early.\
- Move register of other events until end of the 'one time init code'. This helps avoid events that want to hide bars before they are created...
- Auto Hide - create plugin buttons when addon is loaded; same as other Titan plugins
- Config - expand on Help to add features many may not know about, such as drag & drop...
Filename
Titan/Titan.lua
Titan/TitanAutoHide.lua
Titan/TitanConfig.lua
Titan/TitanVariables.lua
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index 3530c98..9683eb8 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -233,6 +233,26 @@ function TitanSetPanelFont(fontname, fontsize)
 	TitanPanel_RefreshPanelButtons();
 end

+local function RegisterForEvents()
+	-- Need to be careful of regeristering for events that initiate
+	-- show / hide of Bars before the Bars can be initialized...
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("CVAR_UPDATE");
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT");
+
+	-- For the pet battle - for now we'll hide the Titan bars...
+	-- Cannot seem to move the 'top' part of the pet battle frame.
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_OPENING_START");
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_CLOSE");
+
+	-- Hide Titan bars in combat (global or per bar); may be useful when using Short bars
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_ENABLED");
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_DISABLED");
+
+	-- User request to hide Top bar(s) in BG or arena; more areas later?
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED");
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_INDOORS");
+	_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+end

 --[[ local
 NAME: TitanPanel_CreateABar
@@ -338,7 +358,7 @@ print("PEW"
 		for idx, v in pairs (TitanBarData) do
 			TitanPanelButton_CreateBar(idx)
 		end
-		Titan_AutoHide_Create_Frames()
+--		Titan_AutoHide_Create_Frames()

 		local realmName = GetRealmName()

@@ -371,6 +391,8 @@ print("PEW"
 			TitanPanelAce:Unhook("OrderHall_CheckCommandBar")
 		end

+		-- Should be safe to register for events that could show / hide Bars
+		RegisterForEvents()
 	end
 	local _ = nil
 	TitanSettings.Player,_,_ = TitanUtils_GetPlayer()
@@ -379,15 +401,7 @@ print("PEW"
 	-- So we need to sync their variables and set them up
 	TitanUtils_RegisterPluginList()

-	-- Init detailed settings only after plugins are registered!
-	local profile_action = nil
-	if new_toon then
-		profile_action = TITAN_PROFILE_RESET
-	else
-		profile_action = TITAN_PROFILE_INIT
-	end
-
-	TitanVariables_UseSettings(nil, profile_action)
+	TitanVariables_UseSettings(nil, TITAN_PROFILE_INIT)

 	-- all addons are loaded so update the config (options)
 	-- some could have registered late...
@@ -440,25 +454,10 @@ function TitanPanelBarButton:ADDON_LOADED(addon)
 		-- Determine WoW TOC Version
 		local wowversion  = select(4, GetBuildInfo())
 		if wowversion >= 100000 then -- Initialize Titan
-			-- Event registration
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("CVAR_UPDATE");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_LOGOUT");
-
-			-- For the pet battle - for now we'll hide the Titan bars...
-			-- Cannot seem to move the 'top' part of the pet battle frame.
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_OPENING_START");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PET_BATTLE_CLOSE");
+			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD")

-			-- Hide Titan bars in combat (global or per bar); may be useful when using Short bars
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_ENABLED");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_REGEN_DISABLED");
-
-			-- User request to hide Top bar(s) in BG or arena; more areas later?
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_INDOORS");
-			_G[TITAN_PANEL_CONTROL]:RegisterEvent("ZONE_CHANGED_NEW_AREA");
-				else
+			TitanVariables_InitTitanSettings() -- Min table setup to start.
+		else
 			-- User loaded wrong Titan version; tried to use retail on Classic or Classic Era
 			-- Could save the user grief; Titan could mangle the saved vars on a version mismatch.
 			TitanPrint("Titan did not initialize!!!!"
@@ -1117,6 +1116,240 @@ end
 --
 -- Titan Bar

+--
+--==========================
+-- Routines to handle moving and sizing of short bars
+--
+
+--[[ local
+NAME: TitanPanel_SetScale
+DESC: Set the scale of each plugin and each Titan bar.
+VAR:  None
+OUT:  None
+--]]
+local function CheckBarBounds(self, width)
+	local trace = false
+	local result = {}
+		result.ok = true
+		result.err = ""
+	local err = ""
+
+	local f_name = self:GetName()
+	local bar_name = TitanBarData[f_name].name
+	local locale_name = TitanBarData[f_name].locale_name
+	local escale = UIParent:GetEffectiveScale()
+
+	if TitanBarData[f_name].user_move
+	and TitanBarDataVars[f_name].show
+	then
+		if trace then
+			print("Bounds"
+			.." "..tostring(bar_name)..""
+			)
+		end
+
+		local tscale = TitanPanelGetVar("Scale")
+		local screen = TitanUtils_ScreenSize()
+		local screen_right_scaled = screen.scaled_x
+		local screen_top_scaled = screen.scaled_y
+		local screen_right = screen.x
+		local screen_top = screen.y
+
+		-- Assumes BOTTOMLEFT of screen per Short bar defaults.
+		-- Top and right adjust an addition pixel,
+		-- if resolution is not 'pixel perfect' rounding could cause algorithm to think bar is off screen
+
+		--- Back out the Titan scaling to get 'real' position within unscaled WoW window
+		-- Use floor to trunc decimal places where the side could be right on the edge of the screen.
+		local orig_w = self:GetWidth()
+		local l_off = math.floor(self:GetLeft() * tscale)
+		local r_off = math.floor(self:GetRight() * tscale)
+		local t_off = math.floor(self:GetTop() * tscale)
+		local b_off = math.floor(self:GetBottom() * tscale)
+
+		if trace then
+			print(">Bounds"
+			.."\n"
+			.." L "..tostring(format("%0.1f", l_off))..""
+			.." R "..tostring(format("%0.1f", r_off))..""
+			.." T "..tostring(format("%0.1f", t_off))..""
+			.." B "..tostring(format("%0.1f", b_off))..""
+--			.."\n"
+			.." S "..tostring(format("%0.1f", screen_right))..""
+			.." x "..tostring(format("%0.1f", screen_top))..""
+			)
+		end
+
+		local w = 0
+		local x_off = 0
+		local y_off = 0
+		local w_off = 0
+
+		-- Assume all ok :)
+		x_off = l_off
+		y_off = b_off
+
+		if (width == 0) then -- drag and drop
+			-- Keep the width
+			w_off = orig_w
+
+			if l_off < 0 then
+				x_off = 0
+				err = "Off left of screen, snap to edge"
+			elseif (r_off) > screen_right then
+--				x_off = math.floor(l_off - math.abs((r_off - screen_right)))
+				x_off = math.floor(screen_right - (r_off - l_off))
+				err = "Off right side of screen, snap to edge"
+			end
+			if err ~= "" then
+				result.ok = false
+				result.err = err
+				if trace then
+					TitanPrint(locale_name.." "..err.."!!!!"
+					, "warning")
+				end
+			end
+			err = ""
+			if (t_off) > screen_top then
+--				y_off = math.floor(b_off - ((t_off) - screen_top))
+				y_off = math.floor(screen_top - (t_off - b_off))
+				err = "Off top of screen, snap to edge"
+			elseif b_off < 0 then
+				y_off = 0
+				err = "Off bottom of screen, snap to edge"
+			end
+			if err ~= "" then
+				result.ok = false
+				result.err = result.err.."\n"..err
+				if trace then
+					TitanPrint(locale_name.." "..err.."!!!!"
+							.." ["..tostring(format("%0.1f", x_off)).."]"
+							.." ["..tostring(format("%0.1f", y_off)).."]"
+					, "warning")
+				end
+			end
+		else -- width change
+			local min_w, min_h, max_w, max_h = self:GetResizeBounds()
+			-- Keep the X and Y
+			w_new = orig_w + width
+			if w_new < min_w then
+				-- do nothing - too small
+				w_off = min_w
+				err = "Width too small. Set to min width."
+			elseif w_new > max_w then
+				w_off = max_w
+				err = "Width too big. Set to max width." -- too wide
+			elseif x_off + w_new > screen_right then
+				w_off = orig_w
+				err = "Off right of screen, snap to edge"
+			else
+				w_off = w_new
+			end
+
+			self:SetSize(w_off, TITAN_PANEL_BAR_HEIGHT)
+--			self:SetWidth(w_off)
+		end
+
+		-- Offsets are saved in without scale
+		TitanVariables_SetBarPos(self, false, x_off, y_off, w_off)
+
+		if trace then
+			print(">>Bounds"
+			.." "..tostring(result.ok)..""
+			.." X "..tostring(format("%0.1f", x_off))..""
+			.." Y "..tostring(format("%0.1f", y_off))..""
+			.." W "..tostring(format("%0.1f", w_off))..""
+			)
+			if err ~= "" then
+				TitanPrint(locale_name.." "..err.."!!!!"
+							.." ["..tostring(format("%0.1f", x_off)).."]"
+							.." ["..tostring(format("%0.1f", y_off)).."]"
+							.." ["..tostring(format("%0.1f", w_off)).."]"
+					, "warning")
+			end
+		end
+	else
+		-- Controlled with anchor points; cannot move so no check is needed
+	end
+
+
+	return result
+end
+
+--[[ local
+NAME: OnMoveStart
+DESC: Start the grap of a Short Titan bar if Shift and left mouse are held.
+VAR:  self - the bar frame
+OUT:  None
+--]]
+local function OnMoveStart(self)
+	if IsShiftKeyDown() then
+		if self:IsMovable() then
+			self.isMoving = true
+			self:StartMoving()
+			_G.GameTooltip:Hide()
+		end
+	else
+		-- Do not move
+	end
+end
+
+--[[ local
+NAME: OnMovingStop
+DESC: When a Short Titan bar drag is stopped.
+VAR:  self - the bar frame
+OUT:  None
+--]]
+local function OnMovingStop(self)
+
+	self:StopMovingOrSizing()
+	self.isMoving = nil
+
+	local res = CheckBarBounds(self, 0)
+	if res.ok then
+		-- placement ok
+	else
+		-- Need to 'snap' it to an edge
+		TitanPanel_InitPanelBarButton("OnMovingStop")
+	end
+	-- Seems overkill - this will recalc all bars...
+end
+
+--[[ local
+NAME: OnMouseWheel
+DESC: Change the width of a Short Titan bar when mouse is over the bar and Shift is held when the mouse wheel is used.
+VAR:  self - the bar frame
+VAR:  d - mouse wheel direction; assuming a 1 'click' is a pixel
+OUT:  None
+NOTE:
+- Can get noisy, "Initializes" all bars at each click to ensure the bar is drawn.
+:NOTE
+--]]
+local function OnMouseWheel(self, d)
+	if IsShiftKeyDown() then
+		local old_w = self:GetWidth()
+		local delta = d
+		if IsControlKeyDown() then
+			delta = d * 10
+		else
+			-- use 1
+		end
+		local res = CheckBarBounds(self, delta)
+		if res.ok then
+		end
+--[[
+print("wheel"
+.." "..tostring(self:GetName())..""
+.." "..tostring(d)..""
+.." old: "..tostring(format("%0.1f", old_w))..""
+.." new: "..tostring(format("%0.1f", self:GetWidth()))..""
+.." ok: "..tostring(res.ok)..""
+)
+--]]
+--		TitanPanel_InitPanelBarButton("OnMouseWheel")
+	end
+end
+
 --[[ Titan
 NAME: TitanPanelBarButton_ForceLDBLaunchersRight
 DESC: Force all plugins created from LDB addons, visible or not, to be on the right side of the Titan bar. Any visible plugin will be forced to the right side on the same bar it is currently on.
@@ -1195,11 +1428,13 @@ VAR:  None
 OUT:  None
 --]]
 function TitanPanelBarButton_DisplayBarsWanted(reason)
---[===[
-print("_DisplayBarsWanted"
-.." "..tostring(reason)..""
-)
---]===]
+	local trace = false
+	if trace then
+		print("_DisplayBarsWanted"
+		.." "..tostring(reason)..""
+		)
+	end
+
 	-- 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
@@ -1266,6 +1501,41 @@ print("showBar"
 	return flag
 end

+local function SetBar(frame)
+	local trace = false
+	local display = _G[frame];
+
+--	local res = CheckBarBounds(display, 0)
+
+	local x, y, w = TitanVariables_GetBarPos(frame)
+	local tscale = TitanPanelGetVar("Scale")
+	local show = TitanBarData[frame].show
+	local bott = TitanBarData[frame].bott
+
+
+		display:ClearAllPoints()
+	if trace then
+--		local screen = TitanUtils_ScreenSize()
+--		local sx = screen.scaled_x
+--		local sy = screen.scaled_y
+		print("SetBar"
+		.." "..tostring(TitanBarData[frame].name)..""
+		.." x:"..tostring(format("%0.1f", x))..""
+		.." y:"..tostring(format("%0.1f", y))..""
+		.." w:"..tostring(format("%0.1f", w))..""
+		)
+	end
+
+	if TitanBarData[frame].user_move then
+		display:SetPoint(show.pt, show.rel_fr, show.rel_pt, x, y)
+		display:SetSize(w, TITAN_PANEL_BAR_HEIGHT)
+	else
+		display:SetPoint(show.pt, show.rel_fr, show.rel_pt, x, y)
+		local h = TITAN_PANEL_BAR_HEIGHT
+		display:SetPoint(bott.pt, bott.rel_fr, bott.rel_pt, x, y - h)
+	end
+end
+
 --[[ Titan
 NAME: TitanPanelBarButton_Show
 DESC: Show / hide the given Titan bar based on the user selection.
@@ -1277,49 +1547,23 @@ NOTE:
 --]]
 function TitanPanelBarButton_Show(frame)
 	local display = _G[frame];
-	local bar = TitanBarData[frame].name

 	if display and TitanBarData[frame].name
 	then
-		local x, y, w = TitanVariables_GetBarPos(frame)
-		local tscale = TitanPanelGetVar("Scale")
-		local show = TitanBarData[frame].show
-		local bott = TitanBarData[frame].bott
-
-		-- Show the display bar if the user requested it
-		-- And there are no conditions preventing...
 		if TitanBarDataVars[frame].show 	-- User requested
 		and showBar(frame)					-- No preventing condition
-		then
-			display:ClearAllPoints();
---[===[
-local screen = TitanUtils_ScreenSize()
-local sx = screen.scaled_x
-local sy = screen.scaled_y
-print("TB_Show"
---.." "..tostring(frame)..""
-.." "..tostring(bar)..""
-.." "..tostring(TitanBarDataVars[frame].show)..""
-)
-print(">>"
---.." "..tostring(show.pt)..""
---.." "..tostring(show.rel_fr)..""
---.." "..tostring(show.rel_pt)..""
-.." x:"..tostring(format("%0.1f", x))..""
-.." y:"..tostring(format("%0.1f", y))..""
-.." w:"..tostring(format("%0.1f", w))..""
-.." sx:"..tostring(format("%0.1f", sx))..""
-.." sy:"..tostring(format("%0.1f", sy))..""
-)
---]===]
-			if TitanBarData[frame].user_move then
-				display:SetPoint(show.pt, show.rel_fr, show.rel_pt, x, y)
-				display:SetSize(w, TITAN_PANEL_BAR_HEIGHT)
+		then								-- Place Bar
+			SetBar(frame)
+---[[
+			-- The bar may need to be moved back onto the screen.
+			local res = CheckBarBounds(display, 0)
+			if res.ok then
+				-- placement ok
 			else
-				display:SetPoint(show.pt, show.rel_fr, show.rel_pt, x, y)
-				local h = TITAN_PANEL_BAR_HEIGHT
-				display:SetPoint(bott.pt, bott.rel_fr, bott.rel_pt, x, y - h)
+				-- Need to 'snap' it to an edge
+				SetBar(frame)
 			end
+--]]
 			TitanPanel_SetBarTexture(frame)

 			if TitanBarData[frame].hider then
@@ -1739,9 +1983,10 @@ local function BuildMainMenu(frame)
 		end
 	TitanPanelRightClickMenu_AddButton(info);

+	TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
 	local glob, toon, player, server = TitanUtils_GetGlobalProfile()
 	info = {};
-	info.text = "Use Global Profile"
+	info.text = "Use Global Profile\n   "..toon
 	info.value = "Use Global Profile"
 	info.func = function()
 		TitanUtils_SetGlobalProfile(not glob, toon)
@@ -2183,167 +2428,6 @@ function TitanPanel_GetPluginSide(id)
 	end
 end

---
---==========================
--- Routines to handle moving and sizing of short bars
---
-
---[[ local
-NAME: TitanPanel_SetScale
-DESC: Set the scale of each plugin and each Titan bar.
-VAR:  None
-OUT:  None
---]]
-local function CheckBarBounds(self, width)
-	local result = {}
-	local err = ""
-	local res = ""
-
-	local f_name = self:GetName()
-	local bar_name = TitanBarData[f_name].name
-	local locale_name = TitanBarData[f_name].locale_name
-	local escale = UIParent:GetEffectiveScale()
-
-	if TitanBarData[f_name].user_move
-	and TitanBarDataVars[f_name].show
-	then
-		local tscale = TitanPanelGetVar("Scale")
---		local tscale = self:GetEffectiveScale()
-		local screen = TitanUtils_ScreenSize()
-		local screen_right_scaled = screen.scaled_x
-		local screen_top_scaled = screen.scaled_y
-		local screen_right = screen.x
-		local screen_top = screen.y
-
-		-- Assumes BOTTOMLEFT of screen per Short bar defaults.
-		-- Top and right adjust an addition pixel,
-		-- if resolution is not 'pixel perfect' rounding could cause algorithm to think bar is off screen
-
-		--- Back out the Titan scaling to get 'real' position within unscaled WoW window
-		-- Use floor to trunc decimal places where the side could be right on the edge of the screen.
-		local orig_w = self:GetWidth()
-		local l_off = math.floor(self:GetLeft() * tscale)
-		local r_off = math.floor(self:GetRight() * tscale)
-		local t_off = math.floor(self:GetTop() * tscale)
-		local b_off = math.floor(self:GetBottom() * tscale)
-
-		local w = 0
-		local x_off = 0
-		local y_off = 0
-		local w_off = 0
-
-		-- Assume all ok :)
-		x_off = l_off
-		y_off = b_off
-		result.ok = true
-		result.err = ""
-
-local show_errs = false
-		if (width == 0) then -- drag and drop
-			-- Keep the width
-			w_off = orig_w
-			res = "Ok"
-
-			if l_off < 0 then
-				x_off = 0
-				err = "Off left of screen, leaving on the edge."
-				res = "Off L"
-			elseif (r_off) > screen_right then
---				x_off = math.floor(l_off - math.abs((r_off - screen_right)))
-				x_off = math.floor(screen_right - (r_off - l_off))
-				err = "Off right side of screen, leaving on the edge."
-				res = "Off R"
-			end
-			if err ~= "" then
-				result.ok = false
-				result.err = err
-				if show_errs then
-					TitanPrint(locale_name.." "..err.."!!!!"
-							.." ["..tostring(format("%0.1f", x_off)).."]"
-							.." ["..tostring(format("%0.1f", y_off)).."]"
-					, "warning")
-				end
-			end
-			err = ""
-			if (t_off) > screen_top then
---				y_off = math.floor(b_off - ((t_off) - screen_top))
-				y_off = math.floor(screen_top - (t_off - b_off))
-				err = "Off top of screen, leaving on the edge."
-				res = "Off T"
-			elseif b_off < 0 then
-				y_off = 0
-				err = "Off bottom of screen, leaving on the edge."
-				res = "Off B"
-			end
-			if err ~= "" then
-				result.ok = false
-				result.err = result.err.."\n"..err
-				if show_errs then
-					TitanPrint(locale_name.." "..err.."!!!!"
-							.." ["..tostring(format("%0.1f", x_off)).."]"
-							.." ["..tostring(format("%0.1f", y_off)).."]"
-					, "warning")
-				end
-			end
-		else -- width change
-			local min_w, min_h, max_w, max_h = self:GetResizeBounds()
-			-- Keep the X and Y
-			w_new = orig_w + width
-			if w_new < min_w then
-				-- do nothing - too small
-				w_off = min_w
-				err = "Width too small. Set to min width."
-				res = "Too small"
-			elseif w_new > max_w then
-				w_off = max_w
-				err = "Width too big. Set to max width." -- too wide
-				res = "Too big"
-			elseif x_off + w_new > screen_right then
-				w_off = orig_w
-				err = "Off right of screen, leaving on the edge."
-				res = "Off R"
-			else
-				w_off = w_new
-				res = "Ok"
-			end
-
-			self:SetSize(w_off, TITAN_PANEL_BAR_HEIGHT)
---			self:SetWidth(w_off)
-			if show_errs and err ~= "" then
-				TitanPrint(locale_name.." "..err.."!!!!"
-							.." ["..tostring(format("%0.1f", orig_w)).."]"
-							.." ["..tostring(format("%0.1f", w_off)).."]"
-					, "warning")
-			end
-		end
-
-		-- Offsets are saved in without scale
-		TitanVariables_SetBarPos(self, false, x_off, y_off, w_off)
-	else
-		-- Controlled with anchor points; cannot move so no check is needed
-	end
-
-	return result
-end
-
---[[ local
-NAME: OnMoveStart
-DESC: Start the grap of a Short Titan bar if Shift and left mouse are held.
-VAR:  self - the bar frame
-OUT:  None
---]]
-local function OnMoveStart(self)
-	if IsShiftKeyDown() then
-		if self:IsMovable() then
-			self.isMoving = true
-			self:StartMoving()
-			_G.GameTooltip:Hide()
-		end
-	else
-		-- Do not move
-	end
-end
-
 --[[
 print("OnMoveStart"
 .." "..tostring(self:GetName())..""
@@ -2355,62 +2439,6 @@ print("OnMoveStart"
 )
 --]]

---[[ local
-NAME: OnMovingStop
-DESC: When a Short Titan bar drag is stopped.
-VAR:  self - the bar frame
-OUT:  None
---]]
-local function OnMovingStop(self)
-
-	self:StopMovingOrSizing()
-	self.isMoving = nil
-
-	local res = CheckBarBounds(self, 0)
-	if res.ok then
-		-- placement ok
-	else
-		-- Need to 'snap' it to an edge
-		TitanPanel_InitPanelBarButton("OnMovingStop")
-	end
-	-- Seems overkill - this will recalc all bars...
-end
-
---[[ local
-NAME: OnMouseWheel
-DESC: Change the width of a Short Titan bar when mouse is over the bar and Shift is held when the mouse wheel is used.
-VAR:  self - the bar frame
-VAR:  d - mouse wheel direction; assuming a 1 'click' is a pixel
-OUT:  None
-NOTE:
-- Can get noisy, "Initializes" all bars at each click to ensure the bar is drawn.
-:NOTE
---]]
-local function OnMouseWheel(self, d)
-	if IsShiftKeyDown() then
-		local old_w = self:GetWidth()
-		local delta = d
-		if IsControlKeyDown() then
-			delta = d * 10
-		else
-			-- use 1
-		end
-		local res = CheckBarBounds(self, delta)
-		if res.ok then
-		end
---[[
-print("wheel"
-.." "..tostring(self:GetName())..""
-.." "..tostring(d)..""
-.." old: "..tostring(format("%0.1f", old_w))..""
-.." new: "..tostring(format("%0.1f", self:GetWidth()))..""
-.." ok: "..tostring(res.ok)..""
-)
---]]
---		TitanPanel_InitPanelBarButton("OnMouseWheel")
-	end
-end
-
 --[[ Titan
 NAME: TitanPanel_InitPanelBarButton
 DESC: Set the scale, texture (graphic), and transparancy of all the Titan bars based on the user selection.
@@ -2420,12 +2448,12 @@ OUT:  None
 function TitanPanel_InitPanelBarButton()
 	-- Set initial Panel Scale
 	TitanPanel_SetScale();
-
+--[===[
 	for idx,v in pairs (TitanBarData) do
 		CheckBarBounds(_G[idx], 0)
 		TitanPanel_SetBarTexture(idx)
 	end
-
+--]===]
 	TitanPanelBarButton_DisplayBarsWanted("InitPanelBarButton")
 end

@@ -2453,8 +2481,8 @@ function TitanPanelButton_CreateBar(frame_str)
 	a_bar:SetScript("OnLeave", function(self) TitanPanelBarButton_OnLeave(self) end)
 	a_bar:SetFrameStrata("DIALOG")

-	local x, y, w = TitanVariables_GetBarPos(frame_str)
-	local tscale = TitanPanelGetVar("Scale")
+--	local x, y, w = TitanVariables_GetBarPos(frame_str)
+--	local tscale = TitanPanelGetVar("Scale")
 --[[
 print("_Create bar"
 .." "..tostring(bar_data.name)..""
@@ -2471,7 +2499,7 @@ print("_Create bar"
 )
 --]]
 	if bar_data.user_move then
-		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
+--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
 		a_bar:SetMovable(true)
 		a_bar:SetResizable(true)
 		a_bar:EnableMouse(true)
@@ -2479,11 +2507,11 @@ print("_Create bar"
 		a_bar:SetScript("OnDragStart", OnMoveStart)
 		a_bar:SetScript("OnDragStop", OnMovingStop)
 		a_bar:SetScript("OnMouseWheel", OnMouseWheel)
-		a_bar:SetSize(w / tscale, TITAN_PANEL_BAR_HEIGHT)
+--		a_bar:SetSize(w / tscale, TITAN_PANEL_BAR_HEIGHT)
 	else
 		-- Static full width bar
-		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
-		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y - TITAN_PANEL_BAR_HEIGHT)
+--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y)
+--		a_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, y - TITAN_PANEL_BAR_HEIGHT)
 	end

 	-- ======
@@ -2514,7 +2542,7 @@ print("_Create hide bar"

 		local hide_bar = CreateFrame("Button", hide_bar_name, UIParent, "TitanPanelBarButtonHiderTemplate")
 		hide_bar:SetFrameStrata("DIALOG")
-		hide_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, -y)
+--		hide_bar:SetPoint(bar_data.show.pt, bar_data.show.rel_fr, bar_data.show.rel_pt, x, -y)

 		-- Set script handlers for display
 		hide_bar:RegisterForClicks("LeftButtonUp", "RightButtonUp");
diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua
index ac0fdb7..9956714 100644
--- a/Titan/TitanAutoHide.lua
+++ b/Titan/TitanAutoHide.lua
@@ -223,4 +223,4 @@ function Titan_AutoHide_Create_Frames()
 end


---Create_Frames() -- do the work
+Titan_AutoHide_Create_Frames() -- do the work
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 99b2dec..c4788ee 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -38,13 +38,15 @@ changes = changes
 	..TitanUtils_GetGoldText("7.00.01.100007 : 2023/03/31\n")
 	..TitanUtils_GetGreenText("Titan : \n")
 	..TitanUtils_GetHighlightText(""
-		.."- NEW : 10 Short bars! See new consolidated Configuration > Titan Bar Help for enabling and using.\n"
+		.."- NEW : 10 Short bars! See new consolidated Configuration > Titan Panel Help for enabling and using.\n"
 		.."- NEW : Skins OR solid color selectable in Config - Global or per bar. \n"
 		.."- NEW : Can Hide any Titan bar by right click on the Titan bar (not a plugin) then click Hide.\n"
 		.."- NEW : Hide in Combat is now selectable in Config - Global or per bar.\n"
 		.."- NOTE : Solid colors are done via the default color picker. Download an enhanced color picker for more options.\n"
-		.."- NOTE : Downgrading from 7.xx to 6.xx bars - Prior to downgrading, move any plugins on a short bar to one of the original full width Titan Bars or Hide the plugin. \nTitan 6.xx will throw an error IF any plugin is assigned to any Short Bar. If Titan throws an error, wipe the Titan saved variables.\n"
-		.."- Configuration > Bars has a new consolidated config for all Titan bars.\n"
+		.."- NOTE : Downgrading from Titan 7.xx to 6.xx - Prior to downgrading, move any plugins on a Short bar to one of the original full width Titan Bars or Hide the plugin.\n"
+		.."--- Titan 6.xx will throw an error IF any plugin is assigned to ANY Short Bar. If Titan throws an error, wipe the Titan saved variables.\n"
+		.."- Configuration > Bars has a new consolidated config for each Titan bar.\n"
+		.."- Configuration > Bars All has a new config for options across all Titan bars.\n"
 		.."- Configuration > Transparency moved into Bars.\n"
 		.."- Configuration > Titan Panel Help has details on using Titan bars.\n"
 		.."- Configuration > Skins shows available skins.\n"
@@ -604,8 +606,8 @@ local optionsUIScale = {
 			get = function() return TitanPanelGetVar("Scale") end,
 			set = function(_, a)
 				TitanPanelSetVar("Scale", a)
-				TitanPanel_SetScale()
-				--TitanPanel_InitPanelBarButton("Config scale change "..a)
+--				TitanPanel_SetScale()
+				TitanPanel_InitPanelBarButton("Config scale change "..a)
 			end,
 			disabled = function()
 				if InCombatLockdown() then
@@ -1065,30 +1067,47 @@ help_text = ""
 	..TitanUtils_GetHighlightText(""
 		.."Short bars are 10 shorter Titan bars that the user can place and change width.\n"
 		.."- Short bars are independent. They may be used with or without the full width Titan bars.\n"
-		.."- Enable and change options using Configuration > Bars.\n"
+		.."- Open Configuration > Bars to enable and change Bar options.\n"
 		.."- The default position is the top center under the full width bars. They will be stacked to not overlap.\n"
 		.."- Move : Use Shift + left mouse and dragging.\n"
 		.."- Change width by 1 : Use Shift + mouse wheel.\n"
 		.."- Change width by 10: Use Shift + Ctrl + mouse wheel.\n"
 		.."- When dragging, best to place your mouse over the left side padding before moving or changing width.\n"
-		.."- When stop dragging, if the Short Bar is beyond the scrren the Short Bar should 'snap' to the edge.\n"
+		.."- When dragging stops, if the Short Bar is beyond the screen edge the Short Bar should 'snap' to the edge.\n"
 		.."- Skin : Can select Skin per Short bar BUT only the 'top' skin is used; some skins have a different top & bottom.\n"
-		.."- Reset : In case a Short bar gets messed up use Reset Position to reset it to original position and width.\n"
+		.."- Reset : In case a Short bar gets messed up, use Reset Position to place it at original position and width. This does not move plugins.\n"
 		.."- Min width : Left side padding plus one icon width.\n"
 		.."- Max width : Screen width.\n"
-		.."- There is NO 'snap together' or grid for placing Short Bars.\n"
+		.."Limitations\n"
+		.."- There is no 'snap together' or grid for placing Short Bars.\n"
 		)
 	.."\n\n"
 	..TitanUtils_GetGreenText("All Bars: \n")
 	..TitanUtils_GetHighlightText(""
-		.."- Hide any Titan bar by right click on the Titan bar (not a plugin) then click Hide.\n"
+		.."- Bar Right click menu shows the name of the Bar in the menu title corresponding to configuration options.\n"
+		.."- Hide any Titan bar by using the Bar Right click menu then click Hide.\n"
+		.."- Titan does not restrict plugins to fit within the visible width. Using Configuration, plugins can be assigned well beyond the visible side. This may be desirable for some users.\n"
+		.."- Setting a plugin to right-side will use the visible right side; and may overlap with left or center aligned plugins.\n"
 		.."- Skins : \n"
 		.."--- Select per Titan bar.\n"
 		.."--- Select a skin for all Titan bars. This does NOT change the individual Titan bar skin settings.\n"
 		.."- Hide in Combat : \n"
 		.."--- Select per Titan bar.\n"
 		.."--- Hide all Titan bars during combat. This does NOT change the individual Titan bar hide in combat settings.\n"
-		.."- NOTE : Right click menu shows the name of the bar in the title to enable finding the correct configuration options.\n"
+		)
+	.."\n\n"
+	..TitanUtils_GetGreenText("Plugins: \n")
+	..TitanUtils_GetHighlightText(""
+		.."Moving Plugins - use one of the methods below:\n"
+		.."--- Open the right-click menu; find the plugin in a category then hide then show.\n"
+		.."--- Drag and drop on another bar or on the same bar.\n"
+		.."--- Drag and drop on another plugin to swap the plugins.\n"
+		.."--- Open Titan Configuration > Plugins then check / uncheck Show then use the Bar dropdown and Right / Left buttons.\n"
+		)
+	..TitanUtils_GetHighlightText(""
+		.."Show / Hide Plugins - use one of the methods below:\n"
+		.."--- Open the right-click Bar menu; find the plugin in a category then click to show / hide the plugin.\n"
+		.."--- Open Titan Configuration > Plugins then select the plugin by name then check / uncheck Show.\n"
 		)
 	.."\n\n"
 end
diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua
index 1162f2f..bf787e6 100644
--- a/Titan/TitanVariables.lua
+++ b/Titan/TitanVariables.lua
@@ -879,6 +879,7 @@ function TitanVariables_InitTitanSettings()
 		end
 	end

+--[===[
 	if TitanSettings.Players[player] then
 		-- all is good
 	else
@@ -905,6 +906,40 @@ function TitanVariables_InitTitanSettings()
 	else
 		-- Set to defaults
 		TitanSettings.Players[player].BarVars = TitanBarVarsDefaults
+		local BV = TitanSettings.Players[player].BarVars
+
+		local panel = TitanSettings.Players[player].Panel
+
+		-- Set the original (full width) Titan bars to the current user settings.
+		-- If this is a new toon or news saved vars then it will just get the original defaults.
+		for idx, v in pairs (TitanBarData) do
+			if v.user_move == false then
+print("orig defs"
+.." "..tostring(idx)..""
+.." "..tostring(v.name)..""
+)
+				-- Set original Bar options from the 'old' saved vars location
+				BV[idx].show = panel[v.name.."_Show"]
+				BV[idx].auto_hide = panel[v.name.."_Hide"]
+				BV[idx].align = panel[v.name.."_Align"]
+				-- only skins before 7.x
+				BV[idx].texure = TitanVars.SKIN
+				BV[idx].skin.alpha = panel[v.name.."_Transparency"]
+				BV[idx].skin.path = panel["TexturePath"]
+print(">_Show"
+.." "..tostring(panel[v.name.."_Show"])..""
+.." > "..tostring(BV[idx].show)..""
+)
+print(">orig defs"
+.." "..tostring(BV[idx].auto_hide)..""
+.." "..tostring(BV[idx].align)..""
+.." "..tostring(BV[idx].skin.alpha)..""
+.." "..tostring(panel["TexturePath"])..""
+.." > "..tostring(BV[idx].skin.path)..""
+)
+			end
+		end
+
 		if trace then
 			TitanDebug("TitanSettings.Players[].BarVars Default")
 		end
@@ -916,28 +951,17 @@ function TitanVariables_InitTitanSettings()
 	TitanPanelSettings = TitanPlayerSettings["Panel"]
 	TitanBarPositions = TitanPlayerSettings["BarData"]
 	TitanBarDataVars = TitanPlayerSettings["BarVars"]
+--]===]

---[[
-	if new_toon then
-		Plugin_settings(true)
-	else
-		TitanVariables_PluginSettingsInit()
-	end
-
-TitanDumpPlayerList()
---]]
-
 	if (TitanAll) then
 		-- All good
 	else
-		TitanAll = TITAN_ALL_SAVED_VARIABLES
-		if trace then
-			TitanDebug("TitanAll Default")
-		end
+		TitanAll = {}
 	end
-
-	-- Current Titan list known - all toons player has logged into so far;
-	-- sort in alphabetical order.
+	TitanVariables_SyncRegisterSavedVariables(TITAN_ALL_SAVED_VARIABLES, TitanAll)
+
+	-- Current Titan list known - all toons player has profiles for
+	-- Sort in alphabetical order.
 	-- Used for menus.
 	TitanVars.players = {}
 	for idx, v in pairs (TitanSettings.Players) do
@@ -953,8 +977,6 @@ end
 --]===]

 	TitanSettings.Version = TITAN_VERSION;
-
-	return new_toon
 end

 --[[ Titan
@@ -1013,8 +1035,8 @@ print("_GetBarPos"
 )
 --]]
 	return
-		TitanBarDataVars[frame_str].off_x, -- / tscale,
-		TitanBarDataVars[frame_str].off_y, -- / tscale,
+		TitanBarDataVars[frame_str].off_x / tscale, -- / tscale,
+		TitanBarDataVars[frame_str].off_y / tscale, -- / tscale,
 		TitanBarDataVars[frame_str].off_w -- / tscale
 end

@@ -1044,6 +1066,34 @@ local function deepcopy(orig)
     return copy
 end

+local function Set_bar_vars(to_profile)
+	if TitanSettings.Players[to_profile].BarVars then
+		-- All good
+	else
+		-- Set to defaults
+		TitanSettings.Players[to_profile].BarVars = TitanBarVarsDefaults
+		local BV = TitanSettings.Players[to_profile].BarVars
+
+		-- Cannot assume profile is current / cannot use Get Var routines.
+		local panel = TitanSettings.Players[to_profile].Panel
+
+		-- Bring original Titan bar optionss to the current user settings.
+		-- If this is a new toon or new saved vars then it will just get defaults.
+		for idx, v in pairs (TitanBarData) do
+			if v.user_move == false then
+				-- Set original Bar options from the 'old' saved vars location
+				BV[idx].show = panel[v.name.."_Show"]
+				BV[idx].auto_hide = panel[v.name.."_Hide"]
+				BV[idx].align = panel[v.name.."_Align"]
+				-- only skins before 7.x
+				BV[idx].texure = TitanVars.SKIN
+				BV[idx].skin.alpha = panel[v.name.."_Transparency"]
+				BV[idx].skin.path = panel["TexturePath"]
+			end
+		end
+	end
+end
+
 --[[ local
 NAME: Init_player_settings
 DESC: Use the Titan settings, the plugin settings, the 'extras' data of the given profile. Create the "to" profile if it does not exist.
@@ -1065,27 +1115,51 @@ NOTE:
 :NOTE
 --]]
 local function Init_player_settings(from_profile, to_profile, action)
+	local trace = false
+
 	local old_player = {}
 	local old_panel = {}
 	local old_plugins = {}
 	local reset = (action == TITAN_PROFILE_RESET)
---[[
-TitanDebug("_UseSettings "
-.."from: "..(from_profile or "?").." "
-.."to_profile: "..(to_profile or "?").." "
-.."action: "..action.." "
-)
---]]
+
+	if trace then
+		print("Init_player_settings"
+		.." from: "..tostring(from_profile)..""
+		.." to: "..tostring(to_profile)..""
+		.." action: "..tostring(action)..""
+		)
+	end

 	CleanupProfile () -- hide currently shown plugins

+	if TitanSettings.Players[to_profile] 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[to_profile] = {}
+		TitanSettings.Players[to_profile].Plugins = {}
+		TitanSettings.Players[to_profile].Panel = TITAN_PANEL_SAVED_VARIABLES
+		TitanSettings.Players[to_profile].Panel.Buttons = {}
+		TitanSettings.Players[to_profile].Panel.Location = {}
+		TitanPlayerSettings = {}
+		TitanPlayerSettings["Plugins"] = {}
+		TitanPlayerSettings["Panel"] = {}
+		TitanPlayerSettings["Register"] = {}
+		TitanPlayerSettings["BarVars"] = TitanBarVarsDefaults -- New Mar 2023
+
+		new_toon = true
+	end
 	-- Set global variables
 	TitanPlayerSettings = TitanSettings.Players[to_profile];
 	TitanPluginSettings = TitanPlayerSettings["Plugins"];
 	TitanPanelSettings = TitanPlayerSettings["Panel"];
-	TitanBarDataVars = TitanPlayerSettings["BarVars"]
-
 	TitanVariables_SyncRegisterSavedVariables(TITAN_PANEL_SAVED_VARIABLES, TitanPanelSettings)
+
+	-- New Mar 2023 : TitanSettings.Players[player].BarData to hold Short bar data
+	Set_bar_vars(to_profile)

 	if action == TITAN_PROFILE_RESET then
 		-- default is global profile OFF
@@ -1094,45 +1168,49 @@ TitanDebug("_UseSettings "
 	elseif action == TITAN_PROFILE_INIT then
 		--
 	elseif action == TITAN_PROFILE_USE then
-		-- 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

-		if from_profile and TitanSettings.Players[from_profile]["BarVars"] then
+		if from_profile and TitanSettings.Players[from_profile] then
 			old_player = TitanSettings.Players[from_profile]
-		else
-		end
-		if old_player and old_player["Panel"] then
-			old_panel = old_player["Panel"]
-		end
-		if old_player and old_player["Plugins"] then
-			old_plugins = old_player["Plugins"]
-		end
-		-- Copy Bar data to this profile
-		if old_player and old_player["BarVars"] then
+			-- The requested from profile at least exists so we can copy from it
+			if old_player["Panel"] then
+				old_panel = old_player["Panel"]
+			end
+			if old_player["Plugins"] then
+				old_plugins = old_player["Plugins"]
+			end
+
+			-- Ensure the old profile Bar data is whole...
+			Set_bar_vars(from_profile)
 			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
+			if trace then
+				-- Apply the new bar positions
+				for idx, v in pairs (TitanBarData) do
+					print("BarVars "
+					.." "..tostring(v.name)..""
+					.." "..tostring(TitanSettings.Players[from_profile]["BarVars"][idx].show)..""
+					.." "..tostring(TitanSettings.Players[to_profile]["BarVars"][idx].show)..""
+					)
+				end
+			end

-		-- Copy the panel settings
-		for index, id in pairs(old_panel) do
-			TitanPanelSetVar(index, old_panel[index]);
-		end
+			-- Copy the panel settings
+			for index, id in pairs(old_panel) do
+				TitanPanelSetVar(index, old_panel[index]);
+			end

-		-- Copy the plugin settings
-		for plugin, i in pairs(old_plugins) do
-			for var, id in pairs(old_plugins[plugin]) do
-				TitanSetVar(plugin, var, old_plugins[plugin][var])
+			-- Copy the plugin settings
+			for plugin, i in pairs(old_plugins) do
+				for var, id in pairs(old_plugins[plugin]) do
+					TitanSetVar(plugin, var, old_plugins[plugin][var])
+				end
 			end
 		end
 	end

+	TitanBarDataVars = TitanPlayerSettings["BarVars"] -- works here, after setting BarVars
+
 	if (TitanPlayerSettings) then
 		-- Synchronize plugin settings with plugins that were registered
 		TitanVariables_SyncPluginSettings()
@@ -1394,7 +1472,7 @@ NOTE:
 --]]
 function TitanVariables_UseSettings(profile, action)
 --[[
-TitanDebug("_UseSettings "
+print("_UseSettings "
 .."profile: "..(profile or "?").." "
 .."action: "..action.." "
 )