Commit Graph
309 Commits
Author SHA1 Message Date
rubidium42andrubidium42 6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Rubidiumandrubidium42 f001e84e5e Codechange: use RAII to automatically restore _cur_dpi after use 2023-01-28 20:33:02 +01:00
PeterNandGitHub c448eb04d8 Fix #10242: Allow a space for text shadow when clipping WWT_EMPTY/WWT_TEXT. (#10243) 2022-12-15 23:21:10 +00:00
Peter NelsonandPeterN 9bf24ec56f Codechange: Reorder and properly declare DrawSpriteIgnorePadding().
Parameters have been rearranged to be closer to those of the standard
DrawSprite() function, and PaletteID can now be set.
2022-11-17 09:12:07 +00:00
Peter NelsonandPeterN ecb5393c55 Change: Standardize progress bar layout.
Progress bars are drawn differently depending on when it was added, with
different layouts and sizes.

This change adds a standard padding size to use, and makes all progress
bars visually similar, with scaled padding.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN ed60c88b0a Change: Use power-of-2 scaling for some dimensions in GUI.
These are related to drawing sprites that are normally drawn on the
landscape, and should therefore still follow power-of-2 scaling to fit
correctly.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN dd90d79e7b Add: Setting to toggle thin vs chunky (scaled) bevels. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN e554fd7808 Change: Hide WidgetDrawDistances from general use. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 23a8222200 Change: Split vscroll and hscroll padding.
Vertical and horizontal scrollbars are different sizes, this allows
different padding for each type.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 90ce704366 Change: Use scaled WidgetDimensions for core widgets. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 0bb9a45785 Change: Simplify drawing widget image buttons. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN d0add1e07f Change: Ignore offsets when drawing GUI sprite. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN b5693becdc Add: Define scaled WidgetDimensions.
Includes RectPadding container.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 0108e9f387 Change: Set up suggested widget padding for panel, frame and inset.
Window handlers are free to ignore the suggested padding, however some
handlers have logic that assumes this information was already provided.
2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 68423c40c5 Fix: Off-by-one in GetAlignedPosition(). 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN dd9f6bc803 Change: Use RectPadding Horizontal()/Vertical() helpers. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN 04cbe57d2a Change: Use RectPadding for widget padding/uz_padding. 2022-11-12 18:28:39 +00:00
Peter NelsonandPeterN f5f035a22b Codechange: Make use of Rect Width/Height helpers. 2022-11-12 18:28:39 +00:00
PeterNandGitHub f24286a1ae Fix: Ensure 31-bit shifts are unsigned. (#10128)
Shifting a signed 32-bit integer by 31 bits is undefined behaviour.
A few more than necessary are switched to unsigned for consistentency.
2022-11-04 07:15:59 +00:00
Peter NelsonandMichael Lutz ba94efba87 Change: Add flag to apply resize to largest resize step first.
Resize step is normally allocated equally amongst all resizable widgets.
With this flag, we allocate as much as possible from the largest
resize step first.
2022-10-16 14:56:34 +02:00
Peter NelsonandMichael Lutz 296af146fb Change: Default widget text colour to black.
TC_FROMSTRING really means blue, and we almost never actually use
blue text.
2022-10-16 14:24:51 +02:00
Patric StoutandPatric Stout 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
2021-06-03 17:30:00 +02:00
PeterNandGitHub 330a305c99 Fix: Apply unscaled padding to Viewport inside WWT_INSET. (#9219)
Since pixel dimensions in SetPadding() are scaled by GUI size, padding for inset viewports was excessive.

Instead, automatically apply padding for WWT_INSET at widget level. This applies to all widgets inside a WWT_INSET, which in all instances is a NWID_VIEWPORT.
2021-05-08 21:01:16 +01:00
Peter NelsonandPeterN d8e06e590a Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.
2021-05-08 09:53:55 +01:00
Peter NelsonandPeterN 52b16237ad Codechange: Don't update window contents if scrollbar position has not moved. 2021-05-08 09:52:54 +01:00
PeterNandGitHub 256dbee255 Fix: Crash when extra viewport height is zero with sign in view. (#9175)
If a viewport sign straddles the top of a viewport, a crash will occur if the viewport height is zero. This is resolved by simply not attempting to draw the viewport in this situation, consistent with other widgets.
2021-05-02 10:21:27 +01:00
Peter NelsonandPeterN 4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN 6fe5353da2 Cleanup: Set unchanging scrollbar properties in constructor. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN 03a43b8247 Cleanup: Call SetMinimalSize instead of setting min_y directly. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN f5569763c9 Fix: Specify width when width is required instead of top. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN 4c6cca459a Cleanup: Remove fairly redundant DrawDropdown() function. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN 5153e1b6e3 Cleanup: Horizontal widget size is commonly width rather than length. 2021-04-30 17:08:15 +01:00
Peter NelsonandPeterN 51b4bd6c38 Codechange: Add widget text colour override property. 2021-04-22 16:42:04 +01:00
Peter NelsonandPeterN 636e37d183 Codechange: Add internal widget alignment property, along with widget part. 2021-04-22 16:42:04 +01:00
Peter NelsonandMichael Lutz 2a0365b3d9 Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
Line height defaults to the resize height of the relevant widget, which is
set in all cases. Therefore it is not necessary to specify this value every time.

Additionally fixes scrolled padding for the framerate window.
2021-04-21 23:12:10 +02:00
Rubidiumandrubidium42 bf4fe19a66 Codechange: merge duplicated logic to scroll in lists by key into a single function 2021-04-21 21:12:08 +02:00
Charles PigottandGitHub dd798d688b Fix #8919: Release builds with asserts enabled (#8925) 2021-04-01 23:57:49 +01:00
Patric StoutandGitHub fece1c57ca Codechange: Suppress warnings when asserts are disabled (#8917) 2021-04-01 11:16:19 +02:00
Tyler TrahanandGitHub de891238d6 Change: Recolour graph windows to brown (#8700) 2021-03-11 15:30:29 +01:00
PeterNandGitHub 9fdc881005 Fix: Scale PIP-padding the same as regular padding. (#8829) 2021-03-09 10:43:04 +01:00
Patric StoutandPatric Stout af22a4f2cd Add: show in the tooltip of disabled toolbar buttons why they are disabled 2021-01-08 16:43:51 +01:00
Charles PigottandGitHub 9b800a96ed Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
TechGeekNZandCharles Pigott a10013dd00 Codechange: Spell 'Viewport' consistently
Some places in the codebase misspell 'Viewport' as 'ViewPort' or 'view_port'.
This patch makes everything consistent.
2020-07-27 17:31:29 +01:00
TechGeekNZandCharles Pigott 8652a4db76 Cleanup: Give SetDirtyBlocks a more descriptive name. 2020-06-09 13:15:47 +01:00
S. D. CloudtandCharles Pigott 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glxandNiels Martin Hansen 1f418555a1 Fix #7742, 66dd7c3: widget position can be negative 2019-09-17 20:11:34 +02:00
Niels Martin Hansen 62dec9f174 Fix: Scale all min size and padding by UI scale 2019-04-24 23:04:55 +02:00
Henry WilsonandMichael Lutz 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Peter NelsonandCharles Pigott de9f54ccc1 Codechange: Change scrolling_scrollbar to mouse_capture_widget, and dispatch OnClick() event if widget is not a scrollbar.
This allows any widget to support mouse capture.
2019-02-21 08:11:35 +00:00