-
-
Notifications
You must be signed in to change notification settings - Fork 971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update window scaling #9087
Merged
Merged
Update window scaling #9087
+354
−211
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Many warnings reported in last commit. I also enabled preview for this PR. |
Ah, adding override specifier when it's missing from existing overrides. For some reason MSVC isn't warning. |
LordAro
reviewed
Apr 24, 2021
rubidium42
reviewed
Apr 29, 2021
Both company icon sprite and text now centred within each row, and extra padding added to avoid the sprites running into each other.
Replaces constant pixel values with values scaled based on font size. This allows the industry chain to maintain a consistent look across different sizes. Previously all except cargo line height were fixed.
rubidium42
approved these changes
Apr 30, 2021
PeterN
added a commit
to PeterN/OpenTTD
that referenced
this pull request
Oct 23, 2022
PeterN
added a commit
that referenced
this pull request
Oct 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
Many windows do not resize properly, either they use hardcoded pixel sizes which do not scale, or they are set up once when opening and not when if the (admittedly rarely) GUI/Font zoom options are changed.
This is a set of patches that... escalated from trying to fix the issue of padding size not being adjusted, and may perhaps need splitting up.
Description
The core functionality is achieved by the parameters to SetPIP/SetPadding/SetMinimalSize/SetMinimalTextLines methods (and therefore from NWidgetParts) is stored within the runtime widget data, allowing it to be reprocessed and adjusted for the current gui/font size setting. This is done rather than reprocessing the NWidgetParts because that would not work for dynamically created widgets.
Because these calls now expect unscaled values, some calls where sprite sizes are used had to be adjusted to get the unzoomed (OUT_4X) sprite size instead.
Additional numerous fixes to layout and padding is also included as separate changes, some of these are independent of this core change, but a few others are dependent on it.
Limitations
Currently vertical scrollbar width varies depending on which widgets they are arranged with. This should probably be fixed by forcing the largest size for all.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.