From a7a05f4ed50bd632b52c4a91dca9f902a72f0f1e Mon Sep 17 00:00:00 2001 From: urnati Date: Sat, 24 Dec 2022 11:05:17 -0500 Subject: [PATCH] - Further changes to scaling; allow user to go below .64 - helps higher resolution screens. --- Titan/TitanAutoHide.lua | 17 ++++++++++++++++- Titan/TitanConfig.lua | 31 ++++++++++++++++++++++--------- Titan/TitanPanel.lua | 25 ++++++++++++++++++------- Titan/TitanVariables.lua | 11 +++++++++++ 4 files changed, 67 insertions(+), 17 deletions(-) diff --git a/Titan/TitanAutoHide.lua b/Titan/TitanAutoHide.lua index e1e5c59..7cfa942 100644 --- a/Titan/TitanAutoHide.lua +++ b/Titan/TitanAutoHide.lua @@ -202,6 +202,7 @@ local function Create_Frames() end -- Display & Hide bars + local top1_d = CreateFrame("Button", "Titan_Bar__Display_Bar", UIParent, "Titan_Bar__Display_Template") top1_d:SetFrameStrata("DIALOG") top1_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0) @@ -209,7 +210,20 @@ local function Create_Frames() local top1_h = CreateFrame("Button", "Titan_Bar__Hider_Bar", UIParent, "TitanPanelBarButtonHiderTemplate") top1_h:SetFrameStrata("DIALOG") top1_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) - +--[===[ +-- NOTE: To allow bars to be less than full screen the BOTTOMRIGHT set point must be commented out! +--_G[bar_name]:SetWidth(screenWidth) +top1_d:SetSize(1000, TITAN_PANEL_BAR_TEXTURE_HEIGHT) +top1_h:SetSize(1000, TITAN_PANEL_BAR_TEXTURE_HEIGHT) +-- bar width test +print("T CHBar" +.." scr w: "..tostring(format("%0.2f", GetScreenWidth())).."" +.." pyh w: "..tostring(GetPhysicalScreenSize()).."" +.." bar: "..tostring(format("%0.2f", top1_d:GetWidth())).."" +.." "..tostring(format("%0.2f", UIParent:GetEffectiveScale())).."" +) +--]===] + local top2_d = CreateFrame("Button", "Titan_Bar__Display_Bar2", UIParent, "Titan_Bar__Display_Template") top2_d:SetFrameStrata("DIALOG") top2_d:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 24) @@ -218,6 +232,7 @@ local function Create_Frames() top2_h:SetFrameStrata("DIALOG") top2_h:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -24) + local bot1_d = CreateFrame("Button", "Titan_Bar__Display_AuxBar", UIParent, "Titan_Bar__Display_Template") bot1_d:SetFrameStrata("DIALOG") bot1_d:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0) diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua index 027e63b..7da277f 100644 --- a/Titan/TitanConfig.lua +++ b/Titan/TitanConfig.lua @@ -139,9 +139,7 @@ VAR: scale - the scale the user has selected for Titan OUT: None --]] local function TitanAdjustPanelScale(scale) - TitanAdjustPanelScale() - - -- Adjust frame positions + TitanPanel_SetScale() TitanPanel_AdjustFrames(true, "AdjustPanelScale") end @@ -656,11 +654,24 @@ local optionsUIScale = { name = L["TITAN_UISCALE_CONTROL_TITLE_UI"], desc = L["TITAN_UISCALE_SLIDER_DESC"], order = 2, type = "range", width = "full", - min = 0.64, max = 1, step = 0.01, - get = function() return UIParent:GetScale() end, + min = 0.3, max = 1, step = 0.01, + get = function() + local ui_scale = TitanPanelGetVar("UIScale") +--[[ +print("T cfg UI scale :" +.." t:"..tostring(format("%0.3f", ui_scale)).."" +--]] + return ui_scale --UIParent:GetScale() + end, set = function(_, a) - SetCVar("useUiScale", 1); - SetCVar("uiScale", a, "uiScale"); + TitanPanelSetVar("UIScale", a) + UIParent:SetScale(a) +-- SetCVar("useUiScale", 1); +-- SetCVar("uiScale", a, "uiScale"); +--[[ +Can go below .64 BUT need to set (below) at each init / reload ... +UIParent:SetScale(a) +--]] end, }, panelscale = { @@ -671,8 +682,10 @@ local optionsUIScale = { get = function() return TitanPanelGetVar("Scale") end, set = function(_, a) if not InCombatLockdown() then - TitanPanelSetVar("Scale", a); - TitanAdjustPanelScale(a) + TitanPanelSetVar("Scale", a) + TitanPanel_SetScale() + TitanPanel_AdjustFrames(true, "Config: adj scale") +-- TitanAdjustPanelScale(a) end end, disabled = function() diff --git a/Titan/TitanPanel.lua b/Titan/TitanPanel.lua index 79d8b5a..76b456b 100644 --- a/Titan/TitanPanel.lua +++ b/Titan/TitanPanel.lua @@ -264,7 +264,6 @@ local function TitanPanel_CreateABar(frame) _G[hide_name]:SetFrameStrata("BACKGROUND") _G[hide_name]:SetHeight(TITAN_PANEL_BAR_HEIGHT/2); - _G[hide_name]:SetWidth(2560); -- Set the display bar local container = _G[frame] @@ -472,8 +471,7 @@ function TitanPanelBarButton:CVAR_UPDATE(cvarname, cvarvalue) or cvarname == "WINDOWED_MODE" or cvarname == "uiScale" then if TitanPlayerSettings and TitanPanelGetVar("Scale") then - TitanAdjustPanelScale() - -- Adjust frame positions + TitanPanel_SetScale() TitanPanel_AdjustFrames(true, "CVar update "..tostring(cvarname)) end end @@ -645,10 +643,8 @@ local function handle_reset_cmds(cmd_list) elseif p1 == "panelscale" then if not InCombatLockdown() then TitanPanelSetVar("Scale", 1); - -- Adjust panel scale - TitanAdjustPanelScale() - -- Adjust frame positions - TitanPanel_AdjustFrames(true, "Config: adj scale") + TitanPanel_SetScale() + TitanPanel_AdjustFrames(true, "Command: reset scale") TitanPrint(L["TITAN_PANEL_SLASH_RESP3"], "info") else TitanPrint(L["TITAN_PANEL_MENU_IN_COMBAT_LOCKDOWN"], "warning") @@ -880,6 +876,21 @@ function TitanPanel_CreateBarTextures() for idx,v in pairs (TitanBarData) do bar_name = TITAN_PANEL_DISPLAY_PREFIX..TitanBarData[idx].name screenWidth = ((_G[bar_name]:GetWidth() or GetScreenWidth()) + 1 ) --/ 2 + +--[===[ + screenWidth = (1900 + 1 ) +--_G[bar_name]:SetWidth(screenWidth) +_G[bar_name]:SetSize(screenWidth, TITAN_PANEL_BAR_TEXTURE_HEIGHT) +-- bar width test +print("T CBar" +.." scr w: "..tostring(format("%0.2f", GetScreenWidth())).."" +.." pyh w: "..tostring(GetPhysicalScreenSize()).."" +.." bar: "..tostring(format("%0.2f", _G[bar_name]:GetWidth())).."" +.." "..tostring(format("%0.2f", UIParent:GetEffectiveScale())).."" +.." "..tostring(screenWidth).."" +.." "..tostring(bar_name).."" +) +--]===] numOfTextures = floor(screenWidth / 256 ) numOfTexturesHider = (numOfTextures * 2) + 1 lastTextureWidth = screenWidth - (numOfTextures * 256) diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index accddd1..c449fd0 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -280,6 +280,7 @@ TITAN_PANEL_SAVED_VARIABLES = { MenuAndBagVerticalAdj = 24, XPBarVerticalAdjOn = false, XPBarVerticalAdj = 24, + UIScale = 0, -- use C Var setting first time }; --[[ Titan @@ -661,6 +662,16 @@ TitanDebug("_UseSettings " Sync_panel_settings(TITAN_PANEL_SAVED_VARIABLES); + local ui_scale = TitanPanelGetVar("UIScale") + local ui_cvar = tonumber(string.format("%0.4f", GetCVar("uiScale"))) -- number not string + if ui_scale == 0 then + -- First time using or reset + TitanPanelSetVar("UIScale", ui_cvar) + else + -- Have seen. User could have changed. + UIParent:SetScale(ui_scale) + end +--]] if action == TITAN_PROFILE_RESET then -- default is global profile OFF TitanAll = {} -- 1.7.9.5