diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index 8169034..4ea033c 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -519,7 +519,7 @@ function TitanPanelBarButton:CVAR_UPDATE(cvarname, cvarvalue)
or cvarname == "WINDOWED_MODE"
or cvarname == "uiScale" then
if TitanPlayerSettings and TitanPanelGetVar("Scale") then
- TitanPanel_InitPanelBarButton() -- TitanPanel_SetScale()
+ TitanPanel_InitPanelBarButton("CVAR_ "..tostring(cvarname))
end
end
end
@@ -711,7 +711,7 @@ local function handle_reset_cmds(cmd_list)
elseif p1 == "panelscale" then
if not InCombatLockdown() then
TitanPanelSetVar("Scale", 1);
- TitanPanel_InitPanelBarButton() -- TitanPanel_SetScale()
+ TitanPanel_InitPanelBarButton()
TitanPrint(L["TITAN_PANEL_SLASH_RESP3"], "info")
else
TitanPrint(L["TITAN_PANEL_MENU_IN_COMBAT_LOCKDOWN"], "warning")
@@ -1226,54 +1226,12 @@ function TitanPanelBarButton_HideAllBars()
end
end
---[[ Titan
-NAME: TitanPanelBarButton_HideTopBars
-DESC: This routine will hide the bars Titan bars (and hiders) regardless of what the user has selected.
-VAR: None
-OUT: None
-NOTE:
-- For example when the class hall
-- We only need to hide the bars (and hiders) - not adjust frames
-:NOTE
---]]
-function TitanPanelBarButton_HideTopBars()
- if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."Bar"].show then
--- if TitanPanelGetVar("Bar_Show") then
- TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."Bar")
- end
- if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."Bar2"].show then
--- if TitanPanelGetVar("Bar2_Show") then
- TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."Bar2")
- end
-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 TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."AuxBar"].show then
--- if TitanPanelGetVar("AuxBar_Show") then
- TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar")
- end
- if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2"].show then
--- if TitanPanelGetVar("AuxBar2_Show") then
- TitanPanelBarButton_Hide(TITAN_PANEL_DISPLAY_PREFIX.."AuxBar2")
- end
-end
-
local function showBar(frame_str)
-- Conditions where this bar should not be shown...
local flag = true -- only set false for known conditions
- if frame_str == TITAN_PANEL_DISPLAY_PREFIX.."Bar"
- or frame_str == TITAN_PANEL_DISPLAY_PREFIX.."Bar2"
+ if frame_str == TitanVariables_GetFrameName("Bar")
+ or frame_str == TitanVariables_GetFrameName("Bar2")
then
-- ===== Battleground or Arena : User selected
if (TitanPanelGetVar("HideBarsInPVP"))
@@ -1334,7 +1292,9 @@ function TitanPanelBarButton_Show(frame)
then
display:ClearAllPoints();
--[===[
-local sx, sy = TitanUtils_ScreenSize(false)
+local screen = TitanUtils_ScreenSize()
+local sx = screen.scaled_x
+local sy = screen.scaled_y
print("TB_Show"
--.." "..tostring(frame)..""
.." "..tostring(bar)..""
@@ -1455,13 +1415,13 @@ function TitanPanel_InitPanelButtons()
local y_off = TitanBarData[idx].plugin_y_offset
prior[bar] = {
right = {
- button = TITAN_PANEL_DISPLAY_PREFIX..bar,
+ button = TitanVariables_GetFrameName(bar),
anchor = "RIGHT",
x = 5, -- Offset of first plugin to right side of screen
y = y_off,
},
left = {
- button = TITAN_PANEL_DISPLAY_PREFIX..bar,
+ button = TitanVariables_GetFrameName(bar),
anchor = "LEFT",
x = 0, -- Justify adjusts - center or not
y = y_off,
diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua
index 4d3c7c4..ac0fdb7 100644
--- a/Titan/TitanAutoHide.lua
+++ b/Titan/TitanAutoHide.lua
@@ -24,13 +24,13 @@ VAR: self - The bar
OUT: None
--]]
local function Titan_AutoHide_SetIcon(self)
- local frame = self:GetName()
+ local frame_auto_hide = self:GetName()
local bar = self.bar_name
+ local frame_str = TitanVariables_GetFrameName(bar)
-- Get the icon of the icon template
- local icon = _G[frame.."Icon"]
- if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..bar].auto_hide then
--- if (TitanPanelGetVar(bar.."_Hide")) then
+ local icon = _G[frame_auto_hide.."Icon"]
+ if TitanBarDataVars[frame_str].auto_hide then
icon:SetTexture("Interface\\AddOns\\Titan\\Artwork\\TitanPanelPushpinOut")
else
icon:SetTexture("Interface\\AddOns\\Titan\\Artwork\\TitanPanelPushpinIn")
@@ -149,11 +149,13 @@ VAR: self - The bar
OUT: None
--]]
function Titan_AutoHide_ToggleAutoHide(bar)
+ local frame_str = TitanVariables_GetFrameName(bar)
+
-- toggle the correct auto hide variable
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..bar].auto_hide =
- not TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..bar].auto_hide --TitanPanelToggleVar(bar.."_Hide")
+ TitanBarDataVars[frame_str].auto_hide =
+ not TitanBarDataVars[frame_str].auto_hide --TitanPanelToggleVar(bar.."_Hide")
-- Hide / show the requested Titan bar
- Titan_AutoHide_Init(TITAN_PANEL_DISPLAY_PREFIX..bar)
+ Titan_AutoHide_Init(frame_str)
end
--[[ Titan
diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index ffa28d1..27bfaa2 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -43,7 +43,7 @@ changes = changes
.."- 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 enhacned color picker for more options.\n"
- .."- NOTE : Downgrading from 7.xx to 6.xx bars - Prior to downgrading, place any plugins on one of the original full width Titan Bars. \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"
+ .."- NOTE : Downgrading from 7.xx to 6.xx bars - Prior to downgrading, place 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"
.."- Configuration > Transparency moved into Bars.\n"
.."- Configuration > Titan Bar Help has details on using Titan bars.\n"
@@ -603,16 +603,15 @@ local optionsUIScale = {
min = 0.75, max = 1.25, step = 0.01,
get = function() return TitanPanelGetVar("Scale") end,
set = function(_, a)
- if not InCombatLockdown() then
- TitanPanelSetVar("Scale", a)
- TitanPanel_InitPanelBarButton("Config scale change "..a)
- end
+ TitanPanelSetVar("Scale", a)
+ TitanPanel_InitPanelBarButton("Config scale change "..a)
end,
disabled = function()
if InCombatLockdown() then
return true
+ else
+ return false
end
- return false
end,
},
buttonspacing = {
@@ -745,16 +744,16 @@ Main (top) controls:
:DESC
--]]
local optionsBars = {
- name = TITAN_PANEL_CONFIG.topic.top, --L["TITAN_PANEL_MENU_OPTIONS_MAIN_BARS"],
+ name = TITAN_PANEL_CONFIG.topic.top,
type = "group",
args = {
}
}
local function ColorShown(bar)
- local res = (bar.locale_name or "?")
- if TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..bar.name].show then
---- if TitanPanelGetVar(bar.name.."_Show") then
+ local res = bar.locale_name
+ local frame_str = bar.frame_name
+ if TitanBarDataVars[frame_str].show then
-- leave as is
else
res = "|cff808080"..res.._G["FONT_COLOR_CODE_CLOSE"]
@@ -790,6 +789,7 @@ local function TitanUpdateConfigBars(t, pos)
for idx = 1, #bar_list do
-- ======
-- Build the bar list in order (left side)
+ -- NOTE: v.name is the 'group' name which is the table passed to callbacks : info[1]
local v = bar_list[idx] -- process this bar
position = position + 1
args[v.name] = {
@@ -799,7 +799,7 @@ local function TitanUpdateConfigBars(t, pos)
}
-- ======
-- Build bar options (right side)
- args[v.name].args = {}
+ args[v.name].args = {} -- ,args caused the nesting / right side
position = position + 1 -- Title divider
args[v.name].args.title = {
type = "header",
@@ -811,13 +811,14 @@ local function TitanUpdateConfigBars(t, pos)
type = "toggle", width = .75, --"fill",
name = L["TITAN_PANEL_MENU_DISPLAY_BAR"],
order = position,
- get = function(info) return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].show --(TitanPanelGetVar(v.name.."_Show"))
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].show
end,
set = function(info, val)
--- TitanPanelToggleVar(v.name.."_Show")
--- TitanPanelBarButton_DisplayBarsWanted(v.name.."_Show "..tostring(TitanPanelGetVar(v.name.."_Show")))
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].show = not TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].show
- TitanPanelBarButton_DisplayBarsWanted(v.name.."Show "..tostring(val))
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ TitanBarDataVars[frame_str].show = not TitanBarDataVars[frame_str].show
+ TitanPanelBarButton_DisplayBarsWanted(info[1].."Show "..tostring(val))
TitanUpdateConfigBars(optionsBars.args, 1000)
end,
}
@@ -827,10 +828,12 @@ local function TitanUpdateConfigBars(t, pos)
name = L["TITAN_PANEL_MENU_AUTOHIDE"],
order = position,
disabled = (v.hider == nil),
- get = function(info) return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].auto_hide --(TitanPanelGetVar(v.name.."_Hide"))
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].auto_hide
end,
set = function(info, val)
- Titan_AutoHide_ToggleAutoHide(v.name) -- short bar name
+ Titan_AutoHide_ToggleAutoHide(info[1]) -- short bar name
end,
}
position = position + 1 -- Center toggle
@@ -838,15 +841,16 @@ local function TitanUpdateConfigBars(t, pos)
type = "toggle", width = .75, --"fill",
name = L["TITAN_PANEL_MENU_CENTER_TEXT"],
order = position,
- get = function()
--- return (TitanPanelGetVar(v.name.."_Align") == TITAN_PANEL_BUTTONS_ALIGN_CENTER)
- return (TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER)
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER)
end,
- set = function()
- if (TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].align = TITAN_PANEL_BUTTONS_ALIGN_LEFT
+ set = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ if (TitanBarDataVars[frame_str].align == TITAN_PANEL_BUTTONS_ALIGN_CENTER ) then
+ TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_LEFT
else
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].align = TITAN_PANEL_BUTTONS_ALIGN_CENTER
+ TitanBarDataVars[frame_str].align = TITAN_PANEL_BUTTONS_ALIGN_CENTER
end
-- Justify button position
@@ -858,14 +862,14 @@ local function TitanUpdateConfigBars(t, pos)
type = "toggle", width = .75, --"fill",
name = L["TITAN_PANEL_MENU_HIDE_IN_COMBAT"],
order = position,
- get = function()
- return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].hide_in_combat
--- return TitanPanelGetVar(v.name.."_HideInCombat")
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].hide_in_combat
end,
- set = function()
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].hide_in_combat =
- not TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].hide_in_combat
--- TitanPanelToggleVar(v.name.."_HideInCombat")
+ set = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ TitanBarDataVars[frame_str].hide_in_combat =
+ not TitanBarDataVars[frame_str].hide_in_combat
end,
}
position = position + 1 -- spacer
@@ -885,8 +889,9 @@ local function TitanUpdateConfigBars(t, pos)
order = position,
disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM),
func = function(info, arg1)
- TitanVariables_SetBarPos(_G[TITAN_PANEL_DISPLAY_PREFIX..v.name], true)
- TitanPanelBarButton_DisplayBarsWanted("Bar reset to default position - "..tostring(v.name))
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ TitanVariables_SetBarPos(_G[frame_str], true)
+ TitanPanelBarButton_DisplayBarsWanted("Bar reset to default position - "..tostring(info[1]))
end,
}
-- ======
@@ -903,10 +908,13 @@ local function TitanUpdateConfigBars(t, pos)
desc = "", --L["TITAN_PANEL_MENU_GLOBAL_SKIN_TIP"],
order = position, type = "select", width = "full",
style = "radio",
- get = function() return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].texure end,
- set = function(_, val)
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].texure = val
- TitanPanel_SetBarTexture(TITAN_PANEL_DISPLAY_PREFIX..v.name)
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].texure end,
+ set = function(info, val)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ TitanBarDataVars[frame_str].texure = val
+ TitanPanel_SetBarTexture(frame_str)
end,
values = {
[TitanVars.SKIN] = L["TITAN_SKINS_TITLE"],
@@ -924,23 +932,23 @@ local function TitanUpdateConfigBars(t, pos)
type = "select", width = "normal",
name = "", --v.locale_name,
order = position,
- get = function()
- return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].skin.path
- -- return TitanPanelGetVar("Texture"..v.name)
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].skin.path
end,
- set = function(_,val)
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].skin.path = val
- -- TitanPanelSetVar("Texture"..v.name, val);
- TitanPanel_SetBarTexture(TITAN_PANEL_DISPLAY_PREFIX..v.name)
- if TitanSkinToRemove == TitanPanelGetVar("Texture"..v.name) then
- -- if TitanSkinToRemove == TitanPanelGetVar("Texture"..v.name) then
+ set = function(info,val)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ TitanBarDataVars[frame_str].skin.path = val
+ TitanPanel_SetBarTexture(frame_str)
+ if TitanSkinToRemove == TitanPanelGetVar("Texture"..info[1]) then
TitanSkinToRemove = "None"
end
end,
- values = function()
+ values = function(info)
local Skinlist = {}
- for _,val in pairs (TitanSkins) do
- if val.path ~= TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].skin.path then
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ for _, val in pairs (TitanSkins) do
+ if val.path ~= TitanBarDataVars[frame_str].skin.path then
-- if val.path ~= TitanPanelGetVar("Texture"..v.name) then
Skinlist[val.path] = "|cff19ff19"..val.name.."|r"
else
@@ -962,14 +970,15 @@ local function TitanUpdateConfigBars(t, pos)
position = position + 1 -- selected skin
args[v.name].args.skinselected = {
name = "",
- image = function()
- local vert = v.vert
+ image = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ local vert = TitanBarData[frame_str].vert
if vert == TITAN_SHORT then
vert = TITAN_TOP
else
-- Use it as is
end
- return TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].skin.path.."TitanPanelBackground"..vert.."0"
+ return TitanBarDataVars[frame_str].skin.path.."TitanPanelBackground"..vert.."0"
end,
imageWidth = 256,
order = position, type = "description", width = .5, --"60",
@@ -981,16 +990,13 @@ local function TitanUpdateConfigBars(t, pos)
order = position,
min = 0, max = 1, step = 0.01,
get = function(info)
- -- local bar = TitanBarData[info[1]].name
- -- return TitanPanelGetVar(v.name.."_Transparency")
- local bar = TITAN_PANEL_DISPLAY_PREFIX..info[1]
- return TitanBarDataVars[bar].skin.alpha
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ return TitanBarDataVars[frame_str].skin.alpha
end,
set = function(info, a)
- local bar = TITAN_PANEL_DISPLAY_PREFIX..info[1]
- _G[bar]:SetAlpha(a)
- TitanBarDataVars[bar].skin.alpha = a
- -- TitanPanelSetVar(info[1].."_Transparency", a);
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ _G[frame_str]:SetAlpha(a)
+ TitanBarDataVars[frame_str].skin.alpha = a
end,
}
position = position + 1 -- Title divider
@@ -1011,22 +1017,28 @@ local function TitanUpdateConfigBars(t, pos)
order = position,
-- disabled = (v.vert == TITAN_TOP or v.vert == TITAN_BOTTOM),
hasAlpha = true,
- get = function()
- local color = TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].color
---[===[
-print("Color:"
-.." "..tostring(format("%0.1f", color.r))..""
-.." "..tostring(format("%0.1f", color.g))..""
-.." "..tostring(format("%0.1f", color.b))..""
-.." "..tostring(format("%0.1f", color.alpha))..""
-)
---]===]
+ get = function(info)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+ local color = TitanBarDataVars[frame_str].color
return color.r,
color.g,
color.b,
color.alpha
end,
set = function(info, r, g, b, a)
+ local frame_str = TitanVariables_GetFrameName(info[1])
+
+ TitanBarDataVars[frame_str].color.r = r
+ TitanBarDataVars[frame_str].color.g = g
+ TitanBarDataVars[frame_str].color.b = b
+ TitanBarDataVars[frame_str].color.alpha = a
+ TitanPanel_SetBarTexture(frame_str)
+ end,
+ }
+ end
+
+ -- Config Tables changed!
+ AceConfigRegistry:NotifyChange("Titan Panel Bars")
--[===[
print("Color new:"
.." "..tostring(format("%0.1f", r))..""
@@ -1035,17 +1047,6 @@ print("Color new:"
.." "..tostring(format("%0.1f", a))..""
)
--]===]
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].color.r = r
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].color.g = g
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].color.b = b
- TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..v.name].color.alpha = a
- TitanPanel_SetBarTexture(TITAN_PANEL_DISPLAY_PREFIX..v.name)
- end,
- }
- end
-
- -- Config Tables changed!
- AceConfigRegistry:NotifyChange("Titan Panel Bars")
end
local function BuildBars()
@@ -1067,11 +1068,13 @@ help_text = ""
.."- The default position is the top center under the full width bars. They will be stacked to not overlap.\n"
.."- Move : Use Alt + left mouse and dragging.\n"
.."- Change width : Use Alt + mouse wheel.\n"
- .."- When moving or changing, best to place your mouse over the left side padding before moving or changing width.\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"
.."- 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"
.."- 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"
)
.."\n\n"
..TitanUtils_GetGreenText("All Bars: \n")
diff --git a/Titan/TitanTemplate.lua b/Titan/TitanTemplate.lua
index c422670..881e206 100644
--- a/Titan/TitanTemplate.lua
+++ b/Titan/TitanTemplate.lua
@@ -72,57 +72,76 @@ local function CheckBarBounds(self, width)
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
--[===[
print("CheckBounds"
.." '"..tostring(bar_name).."'"
.." "..(width == 0 and "drag" or "width")..""
-.." T "..tostring(format("%0.1f", tscale))..""
-.." UI "..tostring(format("%0.1f", UIParent:GetEffectiveScale()))..""
+.." T "..tostring(format("%0.3f", tscale))..""
+.." UI "..tostring(format("%0.3f", UIParent:GetEffectiveScale()))..""
+.."\n ["..tostring(format("%0.1f", screen_right_scaled))..""
+.." X "..tostring(format("%0.1f", screen_top_scaled)).."]"
+.." u["..tostring(format("%0.1f", screen_right))..""
+.." X "..tostring(format("%0.1f", screen_top)).."]"
)
--]===]
-- 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 = self:GetLeft()
- local r_off = self:GetRight()
- local t_off = self:GetTop()
- local b_off = self:GetBottom()
- local screen_right, screen_top = TitanUtils_ScreenSize()
+ 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
-local show_errs = true
+
+ -- Assume all ok :)
+ x_off = l_off
+ y_off = b_off
+
+local show_errs = false
if (width == 0) then -- drag and drop
-- Keep the width
w_off = orig_w
+ res = "Ok"
--[===[
print(">>CheckBounds"
.." '"..tostring(bar_name).."'"
-.." 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))..""
-.." et "..tostring(format("%0.1f", (t_off * tscale)))..""
+.." 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))..""
+.." W "..tostring(format("%0.1f", w_off))..""
+.."\n Tsdiff "..tostring(format("%0.3f", (screen_top - (t_off))))..""
+.." Rsdiff "..tostring(format("%0.3f", (screen_right - (r_off))))..""
)
+--TitanUtils_ScreenSize(true)
--]===]
- -- Assume all ok :)
- x_off = l_off
- y_off = b_off
- res = "Ok"
if l_off < 0 then
x_off = 0
- err = "Off left side of screen, leaving on the edge."
+ err = "Off left of screen, leaving on the edge."
res = "Off L"
- elseif r_off > screen_right then
- x_off = (screen_right - orig_w) - 1
+ 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
@@ -132,8 +151,10 @@ print(">>CheckBounds"
.." ["..tostring(format("%0.1f", y_off)).."]"
, "warning")
end
- if (t_off * tscale) > screen_top then
- y_off = b_off - ((t_off * tscale) - screen_top) - 1
+ 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
@@ -150,28 +171,39 @@ print(">>CheckBounds"
else -- width change
local min_w, min_h, max_w, max_h = self:GetResizeBounds()
-- Keep the X and Y
- x_off = l_off
- y_off = b_off
+ w_new = orig_w + width
- w = orig_w + width
- if w < min_w then
+ 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 > max_w then
+ 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 > screen_right then
+ elseif x_off + w_new > screen_right then
w_off = orig_w
- err = "Off right side of screen, leaving on the edge."
+ err = "Off right of screen, leaving on the edge."
res = "Off R"
else
- w_off = w
+ w_off = w_new
res = "Ok"
end
+--[===[
+print(">>CheckBounds"
+.." '"..tostring(bar_name).."'"
+.." L "..tostring(format("%0.1f", l_off))..""
+.." B "..tostring(format("%0.1f", b_off))..""
+.." oW "..tostring(format("%0.1f", orig_w))..""
+.." nw "..tostring(format("%0.1f", w_new))..""
+.." => "..tostring(format("%0.1f", w_off))..""
+.."\n min "..tostring(format("%0.1f", min_w))..""
+.." max "..tostring(format("%0.1f", max_w))..""
+)
+--]===]
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)).."]"
@@ -181,7 +213,6 @@ print(">>CheckBounds"
end
--[===[
---[[
print(">>CheckBounds"
.." '"..tostring(bar_name).."'"
.." '"..tostring(res).."'"
@@ -191,17 +222,17 @@ print(">>CheckBounds"
.."\n"
.." y "..tostring(format("%0.1f", b_off))..""
.." => "..tostring(format("%0.1f", y_off))..""
-.."\n"
-.." w "..tostring(format("%0.1f", orig_w))..""
-.." + "..tostring(format("%0.1f", width))..""
-.." = "..tostring(format("%0.1f", w_off))..""
-.."\n"
-.." s "..tostring(format("%0.1f", screen_right)).."w"
-.." x "..tostring(format("%0.1f", screen_top)).."h"
+--.."\n"
+--.." w "..tostring(format("%0.1f", orig_w))..""
+--.." + "..tostring(format("%0.1f", width))..""
+--.." = "..tostring(format("%0.1f", w_off))..""
+--.."\n"
+--.." s "..tostring(format("%0.1f", screen_right_scaled)).."w"
+--.." x "..tostring(format("%0.1f", screen_top_scaled)).."h"
)
---]]
--]===]
+ -- 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
@@ -288,14 +319,15 @@ local function OnMouseWheel(self, d)
end
--[[
print("wheel"
-.." "..tostring(f_name)..""
-.." old: "..tostring(old_w)..""
-.." new: "..tostring(self:GetWidth())..""
+.." "..tostring(self:GetName())..""
+.." "..tostring(d)..""
+.." old: "..tostring(format("%0.1f", old_w))..""
+.." new: "..tostring(format("%0.1f", self:GetWidth()))..""
.." ok: "..tostring(res.ok)..""
)
--]]
- -- Seems overkill - this will recalc all bars but recalc of textures could be needed...
- TitanPanel_InitPanelBarButton("OnMouseWheel")
+ -- Seems overkill - this will recalc all bars but recalc of textures could be needed...
+ TitanPanel_InitPanelBarButton("OnMouseWheel")
end
end
@@ -312,8 +344,7 @@ function TitanPanel_SetScale()
-- Set all the Titan bars
for idx,v in pairs (TitanBarData) do
- local bar_name = TITAN_PANEL_DISPLAY_PREFIX..TitanBarData[idx].name
- _G[bar_name]:SetScale(scale)
+ _G[idx]:SetScale(scale)
end
-- Set all the registered plugins
for index, value in pairs(TitanPlugins) do
@@ -435,8 +466,6 @@ local function TitanTooltip_SetPanelTooltip(self, id, frame)
-- Set GameTooltip
local button = TitanUtils_GetButton(id);
- local offscreenX, offscreenY;
- local bar = TITAN_PANEL_DISPLAY_PREFIX..TitanUtils_GetWhichBar(id)
-- Adjust the Y offset as needed
local rel_y = self:GetTop() - GameTooltip:GetHeight()
@@ -1398,14 +1427,14 @@ NOTE:
--]]
function TitanPanelButton_ApplyBarPos(frame_str)
local frame = _G[frame_str]
- local bdata = TitanBarData[frame]
- local fdata = TitanBarDataVars[frame_str]
- if frame and bdata and fdata then
+ local bdata = TitanBarData[frame_str]
+ if frame then
frame:ClearAllPoints();
if bdata.user_move then
- frame:SetPoint(bdata.show.pt, bdata.show.rel_fr, bdata.show.rel_pt, fdata.off_x, fdata.off_y)
+ local x, y, w = TitanVariables_GetBarPos(frame_str)
+ frame:SetPoint(bdata.show.pt, bdata.show.rel_fr, bdata.show.rel_pt, x, y)
else
- -- Set full bar, ignore
+ -- full bar, ignore
end
end
end
@@ -1474,7 +1503,7 @@ function TitanPanelButton_CreateBar(frame_str)
a_bar:SetFrameStrata("DIALOG")
local x, y, w = TitanVariables_GetBarPos(frame_str)
- local sx, sy = TitanUtils_ScreenSize()
+ local tscale = TitanPanelGetVar("Scale")
--[[
print("_Create bar"
.." "..tostring(bar_data.name)..""
@@ -1499,7 +1528,7 @@ print("_Create bar"
a_bar:SetScript("OnDragStart", OnMoveStart)
a_bar:SetScript("OnDragStop", OnMovingStop)
a_bar:SetScript("OnMouseWheel", OnMouseWheel)
- a_bar:SetSize(w, 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)
@@ -1511,7 +1540,8 @@ print("_Create bar"
-- Min : No smaller than the padding & one icon
-- Max : No wider than the screen
-- does not seem to work to restrict size automatically...
- a_bar:SetResizeBounds(TitanBarData[this_bar].plugin_x_offset + 16, TITAN_PANEL_BAR_HEIGHT, sx, TITAN_PANEL_BAR_HEIGHT)
+ local screen = TitanUtils_ScreenSize()
+ a_bar:SetResizeBounds(TitanBarData[this_bar].plugin_x_offset + 16, TITAN_PANEL_BAR_HEIGHT, screen.x, TITAN_PANEL_BAR_HEIGHT)
a_bar:RegisterForClicks("LeftButtonUp", "RightButtonUp");
a_bar:SetScript("OnClick", function(self, button) TitanPanelBarButton_OnClick(self, button) end)
@@ -1542,7 +1572,7 @@ print("_Create hide bar"
hide_bar:SetScript("OnClick", function(self, button) TitanPanelBarButton_OnClick(self, button) end)
hide_bar:SetFrameStrata("BACKGROUND")
- hide_bar:SetSize(sx, TITAN_PANEL_BAR_HEIGHT)
+ hide_bar:SetSize(screen.x / tscale, TITAN_PANEL_BAR_HEIGHT)
else
-- Not allowed for this bar
end
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index fe1e46a..4562475 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -1137,11 +1137,12 @@ VAR: id - id of the plugin to add
OUT: None.
--]]
function TitanUtils_AddButtonOnBar(bar, id)
+ local frame_str = TitanVariables_GetFrameName(bar)
-- Add the button to the requested bar, if shown
if (not bar)
or (not id)
or (not TitanPanelSettings)
- or (not TitanBarDataVars[TITAN_PANEL_DISPLAY_PREFIX..bar].show) --or (not TitanPanelGetVar(bar.."_Show"))
+ or (not TitanBarDataVars[frame_str].show)
then
return;
end
@@ -1151,13 +1152,6 @@ function TitanUtils_AddButtonOnBar(bar, id)
-- update / add to the Location
TitanPanelSettings.Buttons[i] = (id or "?")
TitanPanelSettings.Location[i] = (bar or "Bar")
---[[
-TitanDebug("AddB:"
-.." "..tostring(id)..""
-.." "..tostring(bar)..""
-.." "..tostring(i)..""
-)
---]]
TitanPanel_InitPanelButtons();
end
@@ -1966,9 +1960,11 @@ OUT:
- number - scaled Y / height
--]]
function TitanUtils_ScreenSize(output)
- -- GetScreenWidth GetScreenHeight
- local screen_x = UIParent:GetRight() -- * UIParent:GetEffectiveScale()
- local screen_y = UIParent:GetTop() -- * UIParent:GetEffectiveScale()
+ local screen = {}
+ screen.x = UIParent:GetRight()
+ screen.y = UIParent:GetTop()
+ screen.scaled_x = UIParent:GetRight() * UIParent:GetEffectiveScale()
+ screen.scaled_y = UIParent:GetTop() * UIParent:GetEffectiveScale()
if output then
local x = UIParent:GetRight()
@@ -1991,7 +1987,7 @@ function TitanUtils_ScreenSize(output)
)
end
- return screen_x, screen_y
+ return screen
end
diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua
index 97f67ea..53cbef3 100644
--- a/Titan/TitanVariables.lua
+++ b/Titan/TitanVariables.lua
@@ -1007,10 +1007,27 @@ VAR: frame_str - frame name to retrieve positions from
OUT: X, Y, Width
--]]
function TitanVariables_GetBarPos(frame_str)
+ local tscale = TitanPanelGetVar("Scale")
+--[[
+print("_GetBarPos"
+.." '"..tostring(TitanBarData[frame_str].name).."'"
+.." '"..tostring(tscale).."'"
+)
+--]]
return
- TitanBarDataVars[frame_str].off_x,
- TitanBarDataVars[frame_str].off_y,
- TitanBarDataVars[frame_str].off_w
+ TitanBarDataVars[frame_str].off_x / tscale,
+ TitanBarDataVars[frame_str].off_y / tscale,
+ TitanBarDataVars[frame_str].off_w -- / tscale
+end
+
+--[[ Titan
+NAME: TitanVariables_GetFrameName
+DESC: Build the frame name from the bar name
+VAR: bar_str - frame name to retrieve positions from
+OUT: frame string
+--]]
+function TitanVariables_GetFrameName(bar_str)
+ return TITAN_PANEL_DISPLAY_PREFIX..bar_str
end
-- lua-users.org/wiki/CopyTable
@@ -1358,15 +1375,7 @@ function TitanVariables_SetPanelStrata(value)
local idx, v
-- 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)
+ _G[idx]:SetFrameStrata(bars)
end
-- Set all the registered plugins
for idx, v in pairs(TitanPluginsIndex) do