Commit Graph

339 Commits

Author SHA1 Message Date
Peter Nelson 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 Nelson 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 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
PeterN 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 Nelson 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 Nelson 52b16237ad Codechange: Don't update window contents if scrollbar position has not moved. 2021-05-08 09:52:54 +01:00
PeterN 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 Nelson 4791ff2862 Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed. 2021-04-30 17:08:15 +01:00
Peter Nelson 6fe5353da2 Cleanup: Set unchanging scrollbar properties in constructor. 2021-04-30 17:08:15 +01:00
Peter Nelson 03a43b8247 Cleanup: Call SetMinimalSize instead of setting min_y directly. 2021-04-30 17:08:15 +01:00
Peter Nelson f5569763c9 Fix: Specify width when width is required instead of top. 2021-04-30 17:08:15 +01:00
Peter Nelson 4c6cca459a Cleanup: Remove fairly redundant DrawDropdown() function. 2021-04-30 17:08:15 +01:00
Peter Nelson 5153e1b6e3 Cleanup: Horizontal widget size is commonly width rather than length. 2021-04-30 17:08:15 +01:00
Peter Nelson 51b4bd6c38 Codechange: Add widget text colour override property. 2021-04-22 16:42:04 +01:00
Peter Nelson 636e37d183 Codechange: Add internal widget alignment property, along with widget part. 2021-04-22 16:42:04 +01:00
Peter Nelson 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
Rubidium bf4fe19a66 Codechange: merge duplicated logic to scroll in lists by key into a single function 2021-04-21 21:12:08 +02:00
Charles Pigott dd798d688b
Fix #8919: Release builds with asserts enabled (#8925) 2021-04-01 23:57:49 +01:00
Patric Stout fece1c57ca
Codechange: Suppress warnings when asserts are disabled (#8917) 2021-04-01 11:16:19 +02:00
Tyler Trahan de891238d6
Change: Recolour graph windows to brown (#8700) 2021-03-11 15:30:29 +01:00
PeterN 9fdc881005
Fix: Scale PIP-padding the same as regular padding. (#8829) 2021-03-09 10:43:04 +01:00
Patric Stout af22a4f2cd Add: show in the tooltip of disabled toolbar buttons why they are disabled 2021-01-08 16:43:51 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
TechGeekNZ 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
TechGeekNZ 8652a4db76 Cleanup: Give `SetDirtyBlocks` a more descriptive name. 2020-06-09 13:15:47 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx 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 Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Peter Nelson 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
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
peter1138 efe201d1df (svn r27831) -Fix (r24577): Misaligned resize icon (due to widget bounds being inclusive) 2017-03-26 19:07:08 +00:00
peter1138 bcc5c9f81d (svn r27821) -Change: Draw images in centre of buttons (inspired by Juanjo) 2017-03-23 22:00:00 +00:00
frosch f882a5aa00 (svn r27713) -Fix [FS#6527]: Setup clipping areas for individual widgets when drawing. (adf88) 2016-12-25 17:57:47 +00:00
michi_cc 2b8bb12d62 (svn r27381) -Fix: Warnings due to C++11 requirements for explicit narrowing conversions in initializer lists. 2015-08-10 20:24:13 +00:00
frosch 4830497f0b (svn r27340) -Fix [FS#6338]: Silence warning by moving _string_colourmap to a file no its own. (Cif) 2015-07-26 09:47:17 +00:00
frosch 97d7ad8914 (svn r27303) -Fix [FS#6321]: SetMinimalSize was ignored for WWT_EDITBOX. 2015-06-20 12:29:36 +00:00
frosch 2639b84316 (svn r27255) -Fix [FS#6270]: Combined button+dropdown widgets in order and autoreplace GUI had incorrect hitbox when using GUI zoom. (_dp_) 2015-04-26 11:07:41 +00:00
rubidium e811fa1718 (svn r27030) -Fix: crash when having the vehicle list opened from a buoy or oil rig while the buoy/oil rig gets its final removal (i.e. the sign gets removed) 2014-10-21 19:16:47 +00:00
rubidium 0af26b8a37 (svn r26971) -Fix: widget_data was sometimes uint16 and sometimes uint32; make it always be uint32 2014-10-06 19:16:29 +00:00
peter1138 5a924dcbbc (svn r26965) -Codechange: Add palette bit to indicate that palette is actually a text colour remap, and draw closebox as a sprite, using said bit. Change news popup to use closebox widget for its closebox. 2014-10-05 21:18:37 +00:00
peter1138 9ab2263fda (svn r26964) -Codechange: Allow editbox size to change. 2014-10-05 18:10:01 +00:00
peter1138 ad287d2a2c (svn r26962) -Fix: Set up scrollbar size at the correct time (where it can be changed). Also ensure scrollbar is long enough to at least contain its buttons. 2014-10-05 16:43:44 +00:00
peter1138 0877f892c5 (svn r26960) -Codechange: Draw sort button symbols as sprites, and pad sort buttons with non-static width. 2014-10-05 11:20:02 +00:00
peter1138 34551da879 (svn r26861) -Codechange: Include height of dropdown image in dropdown widget. Draw vertically centred image in dropdown button. 2014-09-20 12:25:36 +00:00
peter1138 0f978d0ad4 (svn r26855) -Codechange: Render vertical scrollbars the same as horizontal scrollbars, with sprites instead of text. 2014-09-20 08:55:35 +00:00
peter1138 41054e73fd (svn r26854) -Codechange: Don't override computed minimal size with static minimal size, instead only increase it. 2014-09-20 00:27:14 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
rubidium 90fef59f80 (svn r26362) -Fix [FS#5906]: reset the default window size icon size just like all the other cached icon sizes (based on patch by MJP) 2014-02-22 19:34:57 +00:00
rubidium f514e31978 (svn r26127) -Fix (r18186): missing break 2013-11-26 15:08:15 +00:00
rubidium 02059ab4a7 (svn r26123) -Fix: make sure the maximum row length when making company buttons is at least 1 2013-11-26 13:27:34 +00:00
rubidium 50fdf5e30c (svn r26121) -Codechange: add some asserts after dynamic casts to show they shouldn't return NULL ever 2013-11-26 13:21:25 +00:00
frosch 12ddbb7cb1 (svn r25864) -Fix: Use the actual sprite dimensions for sizing the dropdown arrow of dropdown widgets. 2013-10-13 19:18:30 +00:00
frosch ca18a4abef (svn r25862) -Fix [FS#5715] (r25729): Usage of implicit unsigned wrap around. (sbr) 2013-10-13 13:49:45 +00:00
frosch 27a77d2c09 (svn r25861) -Fix [FS#5760]: Scale linkgraph legend according to text dimensions. 2013-10-13 13:44:58 +00:00
frosch e3a0337951 (svn r25729) -Fix [FS#5686]: If the child widgets of a NWidgetHorizontal container do not fill the complete container, align them according to text direction. (sbr) 2013-08-18 17:04:13 +00:00
frosch 59b7125563 (svn r25727) -Fix [FS#5686]: NWidgetMatrix used pip_pre and pip_post inconsistently and incorrectly, causing misalignment for RTL. (spotted by sbr) 2013-08-18 15:32:45 +00:00
frosch 43ec0bf0c1 (svn r25537) -Codechange: Optionally make WWT_MATRIX compute the number of rows and columns from the resize step size. 2013-06-30 14:36:31 +00:00
rubidium c90dbe2018 (svn r25468) -Fix-ish: the min/max of the close box were so small the glyph wouldn't even fit between them 2013-06-25 20:39:03 +00:00
frosch 4e4e635916 (svn r25294) -Feature: Add another button to window title bars to resize the window to its default size. 2013-05-26 19:30:07 +00:00
rubidium bdaf082fc2 (svn r25123) -Fix: when the count for a scrollbar was 0, the inter distance was subtracted too much causing a scrollbar with a negative size 2013-03-25 20:59:59 +00:00
frosch 451e2ea02b (svn r25121) -Fix: Editboxes could become too small when resizing windows. 2013-03-24 19:51:53 +00:00
smatz 3a3162865b (svn r24915) -Fix: Several out-of-bounds reads 2013-01-14 21:16:56 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
peter1138 1ef4f7712d (svn r24853) -Fix: Extend widget data member to 32 bits so that sprite IDs >= 2^16 can be used. 2012-12-25 22:10:43 +00:00
frosch 1b3e8a8af6 (svn r24745) -Codechange: Draw complete editbox via QueryString. 2012-11-14 22:50:46 +00:00
frosch f5d8ba5d7f (svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead. 2012-11-14 22:50:35 +00:00
frosch 17025fa6ea (svn r24724) -Codechange: Move drawing of editboxes to the widget drawing code. 2012-11-13 21:46:19 +00:00
planetmaker 78eb17637b (svn r24577) -Fix [FS#5324]: Draw the window resize sprite bottom-aligned (sbr) 2012-10-08 21:27:21 +00:00
frosch 4843bad1ac (svn r24378) -Fix [FS#5218]: ReInit could crash for windows with NWidgetMatrix widgets. 2012-07-07 11:13:41 +00:00
frosch 149672fedb (svn r24346) -Fix: EQUALSIZE widget containers within EQUALSIZE containers were initialised with wrong sizes. 2012-06-16 20:01:34 +00:00
michi_cc 6a70abbd99 (svn r24136) -Feature [FS#4465]: Autoreplace vehicles only when they get old. (Vikthor) 2012-04-17 19:44:02 +00:00
truebrain 403cd3acdb (svn r23631) -Add: ScriptWindow, to manipulate windows on the client (GameScript only) 2011-12-19 21:05:14 +00:00
truebrain df0afdf0dc (svn r23525) -Codechange: make Window::flags4 WindowFlags instead of uint16, with only values known in WindowFlags (and move out 2 timers to their own variable)
-Codechange: rename Window::flags4 to Window::flags
-Codechange: move some non-inline functions from .hpp to .cpp
2011-12-15 19:54:23 +00:00
frosch ca4f0509fc (svn r23252) -Codechange: Add WD_BEVEL_xxx constants. 2011-11-18 20:38:30 +00:00
peter1138 635ccea95d (svn r23024) -Codechange: Vertically centre text within a dropdown control. 2011-10-11 19:05:54 +00:00
peter1138 b0b93cd4a7 (svn r23020) -Codechange: Vertically centre caption text if the caption height is taller than the text. 2011-10-11 13:22:31 +00:00
peter1138 50d1541270 (svn r23017) -Codechange: Add support for resized scrollbars. 2011-10-11 08:07:47 +00:00
planetmaker d0cff8b38b (svn r22869) -Codechange: Use the same constant to set the minimum height of all widgets in the windows title bar 2011-09-02 16:05:19 +00:00
rubidium 1a515e6344 (svn r22405) -Document: some more "random-ish" tidbits 2011-05-01 19:14:12 +00:00
frosch 1ffd720f81 (svn r22383) -Codechange: Rename PALETTE_TO_STRUCT_GREY to PALETTE_NEWSPAPER as it does not belong to the other PALETTE_TO_STRUCT_xxx recolourings. 2011-04-29 20:47:36 +00:00
alberth 31386c42a7 (svn r22145) -Codechange: Do explicit test for non-bool values. 2011-02-25 22:04:38 +00:00
alberth 1dbc0a20be (svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)' 2011-02-25 21:53:43 +00:00
alberth a1df4bea68 (svn r21812) -Fix (r21754): Don't try to scroll the matrix widget to position -1. 2011-01-15 19:54:53 +00:00
frosch 57c6133c3b (svn r21764) -Change: Make the scrollbar associated to a NWidgetMatrix scroll in steps of the matrix when using the wheel or the scrollbar-buttons. 2011-01-09 20:40:35 +00:00
frosch da09ebc59a (svn r21763) -Codechange: Pass the distance to Scrollbar::UpdatePosition() in units of small or big steps. 2011-01-09 20:39:06 +00:00
alberth d8567d2699 (svn r21754) -Codechange: Scroll the matrix widget to make a clicked entry fully visible. 2011-01-09 15:25:33 +00:00
frosch cd7b23b0f4 (svn r21479) -Fix (r9563): Keep transparency for textual stuff in newspaper. 2010-12-12 14:51:26 +00:00
rubidium c1efcb76ca (svn r21451) -Fix (r21449): make sure the matrix's child widget's size is updated with the right widget index 2010-12-10 20:05:20 +00:00
rubidium b91ae2483e (svn r21448) -Add: generic widget for creating a scrollable (one direction) and resizable (both directions) area with same sized widgets 2010-12-10 17:47:11 +00:00
rubidium 0848d92af1 (svn r21447) -Add: accessor function to get the direction of a scrollbar 2010-12-10 17:33:50 +00:00
rubidium 30637a8340 (svn r21157) -Codechange: remove information about the text direction out of the language "list" 2010-11-13 09:56:25 +00:00
alberth af941fc598 (svn r21017) -Doc: Small fixes (by Krille). 2010-10-23 18:12:38 +00:00
rubidium 951b725b8c (svn r20922) -Fix [FS#4071]: accidentally moving the mouse of the scrollbar arrows while pressing it clicks the button next to the arrow 2010-10-15 11:16:14 +00:00
frosch 64d7b84c9f (svn r20587) -Codechange (r20456)[FS#4035]: Revert to scrollbars without minimal size to simplify window setup. 2010-08-21 10:59:03 +00:00
rubidium 3e3cd47222 (svn r20577) -Fix [FS#4043]: scroll button flickering when pressed 2010-08-20 11:55:10 +00:00
yexo 16be24e13a (svn r20558) -Codechange: use one generic function to create a list of company buttons 2010-08-19 12:56:31 +00:00
frosch d496ec65b9 (svn r20470) -Codechange: Make arrow buttons lower and raise like other buttons when clicked. 2010-08-12 16:44:51 +00:00
frosch c16dead108 (svn r20462) -Fix (r20452): Initialise scrollbar_index with -1 to indicate 'no scrollbar associated'. 2010-08-12 09:47:48 +00:00