Skip to content

Commit

Permalink
Scale fixed-size dialogue window capped by screen size percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
gwhitney authored and irydacea committed Jun 29, 2020
1 parent fd0cd29 commit acd08fd
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions data/gui/macros/_initial.cfg
Expand Up @@ -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))"
Expand Down Expand Up @@ -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

###############################################################################
### ###
Expand Down

0 comments on commit acd08fd

Please sign in to comment.