Scale fixed-size dialogue window capped by screen size percentage

This commit is contained in:
Glen Whitney 2020-06-27 10:29:12 -07:00 committed by Iris Morelle
parent fd0cd29683
commit acd08fd0c5

View file

@ -248,16 +248,6 @@
y = "(floor((screen_height - window_height) / 2))"
#enddef
#define GUI_WINDOW_PERC_FIXED_SIZE_CENTERED PERC_W PERC_H WIDTH HEIGHT
automatic_placement = false
width = "(max(screen_width * {PERC_W} / 100, min(screen_width, {WIDTH})))"
height = "(max(screen_height * {PERC_H} / 100, min(screen_height, {HEIGHT})))"
x = "(floor((screen_width - window_width) / 2))"
y = "(floor((screen_height - window_height) / 2))"
#enddef
#define GUI_CENTERED_IMAGE
x = "(max(pos, 0) where pos = floor((width - image_width) / 2))"
y = "(max(pos, 0) where pos = floor((height - image_height) / 2))"
@ -366,10 +356,18 @@
# dpi. It came out looking pretty decent on my 90-micron monitor.
#define GUI_SCALE_RESOLUTION SIZE
"(max({SIZE}, floor({SIZE} * 265 * 2 / (3 * screen_pitch_microns))))"
(max({SIZE}, floor({SIZE} * 265 * 2 / (3 * screen_pitch_microns))))
#enddef
#define GUI_WINDOW_PERC_FIXED_SIZE_CENTERED PERC_W PERC_H WIDTH HEIGHT
automatic_placement = false
width = "(max(min(screen_width, {WIDTH} ), min(screen_width * {PERC_W} / 100, {GUI_SCALE_RESOLUTION {WIDTH} })))"
height = "(max(min(screen_height, {HEIGHT}), min(screen_height * {PERC_H} / 100, {GUI_SCALE_RESOLUTION {HEIGHT}})))"
x = "(floor((screen_width - window_width) / 2))"
y = "(floor((screen_height - window_height) / 2))"
#enddef
###############################################################################
### ###