1
0
Fork 0
Commit Graph

349 Commits (649ed702cc70501c17ebea72289d89186995d59b)

Author SHA1 Message Date
Peter Nelson 274b7a0195
Fix #13645: "Follow vehicle" button not raised when following stopped. (#13746) 2025-03-06 00:00:57 +00:00
Peter Nelson 27761ae431 Cleanup: Remove global string parameters.
Global parameters, and functions for dealing with them, are now gone.
2025-03-04 08:48:35 +00:00
Rubidium d94d421772 Codechange: prepare for replacement of SetStringParameter by GetWidgetString 2025-03-02 11:04:15 +01:00
Rubidium adb0858c05 Codechange: remove ZeroedMemoryAllocator from Window 2025-02-28 20:12:44 +01:00
Rubidium 5cee804f98 Codechange: remove ZeroedMemoryAllocator from NWidgetBase 2025-02-22 14:38:33 +01:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Jonathan G Rennison d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Peter Nelson 2cb9f55183 Codechange: Store EncodedString for tooltip text.
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Rubidium 04d53ed6f5 Codechange: remove operator!=s that are synthesized 2025-02-08 06:37:36 +01:00
Rubidium 9bfddcdbbe Codechange: make WindowNumber accept ConvertibleThroughBase types 2025-02-02 19:45:17 +01:00
Rubidium e36a9ceaf0 Codechange: allow passing extra constructor arguments via AllocateWindowDescFront 2025-02-02 15:57:18 +01:00
Rubidium 8f72a478f0 Codechange: change 'return existing window' to a template parameter
This change is made to make it possible to pass arbitrary other parameters
to the constructor of the window instances.
2025-02-02 15:57:18 +01:00
Rubidium 55588b052e Codechange: add concept of ConvertibleThroughBase for strong types
This makes it possible to write templated alternatives for ConvertibleThroughBase
which are then available for any (strong) type that implements a base() function
In the end making adding new ConvertibleThroughBase types less awkward.
2025-02-01 19:22:02 +01:00
Peter Nelson 56b1e9df1f Codechange: Use EnumBitSet for FrameFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson d30e8dd1c1 Codechange: Use EnumBitSet for WindowDefaultFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson efb05396a7 Codechange: Use EnumBitSet for WindowFlags. 2025-01-30 08:40:42 +00:00
Peter Nelson afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. (#13383) 2025-01-28 22:17:34 +00:00
Peter Nelson b7a82819de Codechange: Remove ZeroedMemoryAllocator from WindowDesc.
All members which are not intended to be changed are now const to ensure they are set
2025-01-26 16:42:05 +00:00
Rubidium bfc8ae6c52 Codechange: use accessor for (scrollbar_)index as they are read only 2025-01-04 20:51:47 +01:00
Peter Nelson b653f875b0
Codechange: Space between `template` and `<` (#13278)
Make it all consistent so it matches CODINGSTYLE.
2025-01-04 17:56:14 +00:00
Peter Nelson e1697a6ad1
Codechange: Don't use enums for non-enumerated values. (#13031)
In the past we have used enums to hold an arbitrary values. These values
are not enumerated types, so make them constants instead.
2024-10-27 18:02:49 +00:00
Peter Nelson 3cd1200668
Fix #12976: Incorrect widget rect scrolling for RTL languages. (#12978)
Industry directory, AS/GS and Textfile window did not consider RTL when applying horizontal scrolling.
2024-10-05 08:02:59 +01:00
Rubidium 14200212b7 Codechange: use std::optional<std::string> over char * for text query results 2024-06-29 16:33:16 +02:00
Peter Nelson 55314513ce
Codechange: Pass NWidgetParts as span instead of begin/end pointers. (#12779) 2024-06-12 23:08:35 +01:00
Peter Nelson 4cf6d1dd79
Codechange: Pass WindowDesc by reference instead of pointer. (#12771)
WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
2024-06-11 08:58:03 +01:00
Peter Nelson 7e049aa2b1 Change: Use aspect ratio for common left/right buttons. 2024-04-19 22:11:16 +01:00
Peter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01:00
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
Peter Nelson 2485de9462
Codefix: Widget should be passed as WidgetID type. (#12332) 2024-03-18 20:32:38 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Peter Nelson ac44c001a4 Codechange: Expose `FindChildWindow()` as a method of `Window`. 2024-02-07 17:13:37 +00:00
Peter Nelson d3c673e20b
Fix #11894: Defer window OnResize event to avoid processing multiple times per input tick. (#11900) 2024-01-27 18:44:27 +00:00
Peter Nelson 691c628b07
Codechange: Use named initialization for unscaled WidgetDimensions. (#11859)
Remove now-unused WD_* enums.
2024-01-21 18:10:49 +00:00
Peter Nelson 68843e3a96 Codechange: Move WidgetDimensions::unscaled to header to allow const use. 2024-01-16 21:57:05 +00:00
Peter Nelson 71aaed860b
Codechange: Missing some conversions to WidgetID. (#11773) 2024-01-14 16:47:10 +00:00
Rubidium 3a676a5af0 Codechange: replace static inline with static for non-class functions 2024-01-06 13:37:33 +01:00
Peter Nelson 7124b4eef1 Codechange: Use std::unique_ptr for all NWidgets. 2023-12-31 15:33:56 +00:00
Peter Nelson f3b4d2a384
Fix #11649: Ignore disabling a widget that does not exist. (#11652)
Orders window has different widget layouts depending on vehicle type
which don't all have the same widgets, and therefore it tries to disable
widgets that might not exist.

Restore the old behaviour of ignoring such requests, instead of crashing.
2023-12-30 13:29:31 +00:00
Peter Nelson a0dfb76e34 Codechange: Replace mishmash of types for widget index with WidgetID.
Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
2023-12-30 00:23:57 +00:00
Peter Nelson b86182ab84 Codechange: Use std::map to provide indexed widget access.
This removes the need to determine the biggest widget index and replaces C-style memory handling.
2023-12-29 18:45:43 +00:00
Peter Nelson a12f426d69 Codechange: Rename nested array to widget lookup.
This changes from naming storage-type to naming functionality.

* `FillNestedArray` is renamed to `FillWidgetLookup`.
* `Window::nested_array` is renamed to `Window::widget_lookup`.
* `array` parameter renamed as well.
2023-12-29 18:45:43 +00:00
Peter Nelson feb94d233d
Codechange: Remove deferred nested_array initialization path. (#11640)
Having two ways (`FillNestedArray` and `SetupSmallestSize`) to initialize
`Window::nested_array` introduces confusion.

Instead, make `FillNestedArray` the canonical way, always call it, and remove
init_array from `SetupSmallestSize`.
2023-12-29 14:27:04 +00:00
Peter Nelson 3317e29847 Fix #11516: Adjust window size by interface scale during ReInit.
To simplify this and ensure that scaling only occurs once, regardless of
resize nesting, each window now remembers interface scale.
2023-12-07 23:58:32 +00:00
Peter Nelson 60565da8f9
Codechange: Add specific WidgetDimension for dropdown list window. (#11554)
This avoids contorting fullbevel dimensions.
2023-12-07 16:10:09 +00:00
Peter Nelson 58c252b81a Cleanup: Remove unnecessary pressed button offset code. 2023-12-05 21:12:35 +00:00
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 2023-11-09 20:15:38 +00:00
Peter Nelson 55adbe10b7 Add: WidgetDimensions for 'sparse' widget windows.
These are for windows that have space between widgets instead of being clumped together.
2023-11-07 23:09:05 +00:00
Peter Nelson ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
2023-11-06 20:29:35 +00:00
Peter Nelson 665902f5ba Codechange: Add widget dimensions to standardise picker winodws. 2023-11-05 20:09:45 +00:00