Fix: improve appearance of toolbars and main menu images/text#15402
Merged
PeterN merged 3 commits intoOpenTTD:masterfrom Mar 31, 2026
Merged
Fix: improve appearance of toolbars and main menu images/text#15402PeterN merged 3 commits intoOpenTTD:masterfrom
PeterN merged 3 commits intoOpenTTD:masterfrom
Conversation
Reduces duplication in SetMinimalSize / SetMinimalTextLines
… hardcoded value This improves appearance with basesets that use a different sprite size for toolbar icons.
…ensions Fixes appearance with original basesets
6bb771d to
c65bf82
Compare
rubidium42
approved these changes
Mar 28, 2026
This file contains hidden or 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
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
The images used on the main menu are highly dependent on the baseset used, and currently rely on all images being the same size.
This unfortunately doesn't hold for all basesets, most notably the original TTD baseset, and this results in the text of the main menu not being aligned neatly.
Part of the issue is that the method to set button size relative to toolbar button sizes uses a hardcoded pixel size value, which may not actually match the loaded baseset.
This is noticeable when using a graphics set such as "aBase" or "biggui", which use larger than intended toolbar icons, but only for some toolbar icons, resulting in a weird mix of sizes.
Description
These issues are resolved by making toolbar-button-sizes relative to the largest normal toolbar icon, instead of the hardcoded 20 pixels, and then forcing the image part of image-text buttons to be square, based on toolbar button sizing.
This is not 100% ideal for image-text buttons, but there are currently no other users of this widget type so it's mostly fine.
It's still not really recommended to use larger icons than designed, as it will always cause inconsistency with NewGRF addons which are generally designed for the default button size.
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.