Skip to content

Commit 36b5413

Browse files
author
LocalIdentity
committed
Add setting to override Windows scaling from PoB
Adds a setting in the options menu that allows the user to override the scaling PoB uses incase they don't want it to look the same as their windows scaling Relies on PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic#86
1 parent f1b5a06 commit 36b5413

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/Modules/Main.lua

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function main:Init()
9898
self.decimalSeparator = "."
9999
self.defaultItemAffixQuality = 0.5
100100
self.showTitlebarName = true
101+
self.dpiScaleOverridePercent = GetDPIScaleOverridePercent and GetDPIScaleOverridePercent() or 0
101102
self.showWarnings = true
102103
self.slotOnlyTooltips = true
103104
self.notSupportedModTooltips = true
@@ -633,6 +634,10 @@ function main:LoadSettings(ignoreBuild)
633634
if node.attrib.showFlavourText then
634635
self.showFlavourText = node.attrib.showFlavourText == "true"
635636
end
637+
if node.attrib.dpiScaleOverridePercent then
638+
self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0
639+
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
640+
end
636641
end
637642
end
638643
end
@@ -745,7 +750,8 @@ function main:SaveSettings()
745750
invertSliderScrollDirection = tostring(self.invertSliderScrollDirection),
746751
disableDevAutoSave = tostring(self.disableDevAutoSave),
747752
--showPublicBuilds = tostring(self.showPublicBuilds),
748-
showFlavourText = tostring(self.showFlavourText)
753+
showFlavourText = tostring(self.showFlavourText),
754+
dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent)
749755
} })
750756
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
751757
if not res then
@@ -853,6 +859,24 @@ function main:OpenOptionsPopup()
853859
controls.proxyURL:SetText(url)
854860
end
855861

862+
nextRow()
863+
controls.dpiScaleOverride = new("DropDownControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 150, 18 }, {
864+
{ label = "Use system default", percent = 0 },
865+
{ label = "100%", percent = 100 },
866+
{ label = "125%", percent = 125 },
867+
{ label = "150%", percent = 150 },
868+
{ label = "175%", percent = 175 },
869+
{ label = "200%", percent = 200 },
870+
{ label = "225%", percent = 225 },
871+
{ label = "250%", percent = 250 },
872+
}, function(index, value)
873+
self.dpiScaleOverridePercent = value.percent
874+
SetDPIScaleOverridePercent(value.percent)
875+
end)
876+
controls.dpiScaleOverrideLabel = new("LabelControl", { "RIGHT", controls.dpiScaleOverride, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7UI scaling override:")
877+
controls.dpiScaleOverride.tooltipText = "Overrides Windows DPI scaling inside Path of Building.\nChoose a percentage between 100% and 250% or revert to the system default."
878+
controls.dpiScaleOverride:SelByValue(self.dpiScaleOverridePercent, "percent")
879+
856880
nextRow()
857881
controls.buildPath = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 290, 18 })
858882
controls.buildPathLabel = new("LabelControl", { "RIGHT", controls.buildPath, "LEFT" }, { defaultLabelSpacingPx, 0, 0, 16 }, "^7Build save path:")
@@ -1039,6 +1063,7 @@ function main:OpenOptionsPopup()
10391063
local initialDisableDevAutoSave = self.disableDevAutoSave
10401064
--local initialShowPublicBuilds = self.showPublicBuilds
10411065
local initialShowFlavourText = self.showFlavourText
1066+
local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent
10421067

10431068
-- last line with buttons has more spacing
10441069
nextRow(1.5)
@@ -1064,6 +1089,7 @@ function main:OpenOptionsPopup()
10641089
if not launch.devMode then
10651090
main:SetManifestBranch(self.betaTest and "beta" or "master")
10661091
end
1092+
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
10671093
main:ClosePopup()
10681094
main:SaveSettings()
10691095
end)
@@ -1091,6 +1117,8 @@ function main:OpenOptionsPopup()
10911117
self.disableDevAutoSave = initialDisableDevAutoSave
10921118
self.showPublicBuilds = initialShowPublicBuilds
10931119
self.showFlavourText = initialShowFlavourText
1120+
self.dpiScaleOverridePercent = initialDpiScaleOverridePercent
1121+
SetDPIScaleOverridePercent(self.dpiScaleOverridePercent)
10941122
main:ClosePopup()
10951123
end)
10961124
nextRow(1.5)

0 commit comments

Comments
 (0)