Commit Graph

620 Commits

Author SHA1 Message Date
mmtunligit 7662105081 Change: Clamp terraform toolbar to main toolbar (#14725) 2025-11-13 18:25:21 -05:00
Peter Nelson 1229a498b7 Codechange: Add constant for INVALID_WIDGET. (#14649)
Replaces direct use of -1, making it easier to find.
2025-09-21 21:47:04 +00:00
Peter Nelson 69697a62d3 Fix 8c58fb1efd: Doubled beep sounds when clicking toolbar buttons.
* ShowDropDownList() now issues a beep, so individual toolbar buttons no longer need to do it.
* HandleButtonClick() may be called twice for some buttons, as it is called by automatically for PUSH buttons.

This caused some beeps to sound louder than others.
2025-09-21 10:12:22 +01:00
Peter Nelson 129825077b Change: Apply interface scale to window snap distance. (#14625) 2025-09-17 12:29:16 +01:00
Rubidium 7c0f69a8fe Codefix: typos in comments and strings 2025-08-31 10:30:37 +02:00
Peter Nelson ea9bee2a3e Fix: Close dropdown menu when user clicks on a differenet window.
This did not happen if the clicked window is flagged as unfocusable (i.e. the main toolbar.)
2025-08-18 19:48:22 +01:00
Tyler Trahan 8c58fb1efd Fix: Missing button beeps (#14470) 2025-08-05 13:57:45 -04:00
Peter Nelson 10841ea3fd Codechange: Add constant for common blink interval. 2025-06-07 15:50:25 +01:00
Peter Nelson 984d864c72 Codechange: Add OnClick handler for dropdown items.
This allows each dropdown item to indicate if something different should happen depending on where in the item was clicked.
2025-05-25 09:13:05 +01:00
Peter Nelson 7344dfe651 Change: Reflow Textfile window content incrementally.
This avoids a stall when reflowing a long text file with some truetype fonts.
2025-05-23 07:42:10 +01:00
Peter Nelson 780c26237f Codechange: Add OnScrollbarScroll window event, called when a scrollbar position changes. 2025-05-23 07:42:10 +01:00
frosch c037722cb5 Fix 51a7edd: NewGRF debug sprite picker was broken. (#14246) 2025-05-10 20:27:43 +02:00
frosch 51a7edd941 Codechange: Remove _input_events_this_tick. 2025-05-06 18:29:41 +02:00
frosch 0d5b3ebd7f Codechange: Declare all IntervalTimers const, which can be const. 2025-05-06 18:29:41 +02:00
Peter Nelson dabf2ede67 Change: Add methods to close child windows with a specific window number. 2025-05-04 19:36:46 +01:00
Peter Nelson 3e608b5fe4 Fix: Zoom-scroll extra viewports only if the mouse cursor is over the viewport. (#14209) 2025-05-04 14:16:05 +01:00
frosch 8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
Rubidium 7805c1c189 Codechange: use std::string_view for ini_key 2025-05-01 23:24:43 +02:00
frosch 66733e2a50 Codechange: Use std::string_view in IME input handling. 2025-04-30 19:33:56 +02:00
Rubidium ef71ce0a9d Codechange: return std::string_view for Textbuf::GetText() 2025-04-29 22:15:49 +02:00
Peter Nelson 7846f0f4ee Fix a4dc7249ee: Changing language or interface scale could hang. (#14087)
A bit of hysteresis caused by OnResize calling ReInit calling OnResize calling ReInit calling OnResize calling ReInit ...
2025-04-24 00:29:54 +01:00
Peter Nelson 788845f731 Change: Allow Double-Ctrl+Click on default size box to clear saved size. (#14055) 2025-04-21 14:16:29 +01:00
Peter Nelson e9a92b8795 Fix: Odd drawing and crash if scrollbar is not tall enough. (#14052)
Under certain conditions the scrollbar "tab" could be too large for the scrollbar, and cause issues.

Caused by an off-by-one in height calculation.
2025-04-20 23:23:52 +01:00
Peter Nelson 2c59838acb Codechange: (re)set multiple bitset flags in one call. (#14017) 2025-04-18 14:07:57 +01:00
Peter Nelson c982816c0e Codechange: Manage window viewport via unique_ptr. 2025-04-09 22:03:23 +01:00
Peter Nelson 8275bbfb87 Codechange: Pass Viewport by reference.
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
Peter Nelson 2909a14374 Codechange: Include table/strings.h in files that use StringIDs.
Be consistent with how and where the file is incldued.
2025-03-21 12:53:40 +00:00
Peter Nelson de45f5418b Fix 0de7fd3c24: widget_lookup may contain non-NWidgetCore widgets. (#13787) 2025-03-09 19:49:26 +00:00
Rubidium 0de7fd3c24 Codefix: check the result of dynamic_cast for nullptr 2025-03-09 19:35:14 +01:00
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 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +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
Peter Nelson 693a5f42b9 Codechange: Use EnumBitSet for NWidgetDisplayFlags. 2025-02-06 19:43:35 +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 f7aaf8ea24 Codechange: use StrEmpty instead of number of bytes in string to check for empty 2025-01-23 10:11:22 +01:00
Rubidium bfc8ae6c52 Codechange: use accessor for (scrollbar_)index as they are read only 2025-01-04 20:51:47 +01:00
Rubidium 56d4d3cc7a Codechange: add and use GetToolTip instead of direct access 2025-01-03 11:10:05 +01:00
Eri the Switch 32dfb37b9d Change: Use floats for tracking 2D scrolling
This ensures the smoothest experience possible when dragging map
around with 2D scrolling.
2024-12-14 15:43:31 +00:00
Peter Nelson a3437df7b7 Fix #13121: Crash when clicking on scrollbar if contents don't need scrolling. (#13122) 2024-11-25 08:20:20 +00:00
Peter Nelson 0c04966dc3 Fix #13022: Ensure minimum size of scrollbar slider. (#13119)
When there are many more items than fit in a list, the scrollbar slider scales to fit but there is no minimum size. It becomes too small to click on and use.

Ensure scrollbar slider is at least the same size as the buttons either end.
2024-11-24 11:50:04 +00:00
Peter Nelson 3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +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 3bfd9de68d Fix: Highscore/Endgame window can disappear offscreen if game window is resized. (#12951) 2024-09-19 09:18:25 +01:00
Jonathan G Rennison 1e3855c9c3 Fix: Crash when pressing arrow keys in bootstrap mode (#12948) 2024-09-18 16:41:54 -04:00
steve-goldman f5f488e778 Change: improve when to stops following vehicle (#12808)
- Changing zoom no longer stops following vehicle
- Key scrolling while following a vehicle stops following
- Autoscrolling while following a vehicle stops following
- Main viewport can begin following a vehicle at any zoom
2024-07-01 01:13:47 +02:00