Commit Graph

455 Commits

Author SHA1 Message Date
Tyler Trahan
fd9e72a7e7
Feature: Use real-time "wallclock" timekeeping units (#11341) 2024-01-23 11:36:09 -05:00
Patric Stout
d3b2a576de
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628) 2024-01-22 19:22:45 +00:00
Peter Nelson
7737aa6640 Codechange: Make all NWidgetPart arrays constexpr.
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00:00
Michael Lutz
e1f5be6244 Add: GUI options to select sprite font and AA mode for all fonts. 2024-01-14 22:50:56 +01:00
Rubidium
e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter Nelson
268e512fb8 Codechange: Set storage type of widget enums to WidgetID. 2023-12-30 00:23:57 +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
daec0e2ca4 Codechange: Split palette handling to separate file. 2023-12-25 11:22:52 +00:00
Loïc Guilloux
2d3af14181
Add: Horizontal scroll for script debug log (#11597) 2023-12-20 22:50:03 +01:00
Peter Nelson
09251d993c
Change: Use sparse padding for network server list. (#11571) 2023-12-10 14:48:58 +00:00
Peter Nelson
a29766d6cc Codechange: Move dropdown list size and position calculation to window.
This simplifies initialization of DropdownWindow, as instead of both the caller code and the class needing to know about list sizes and available space, only the DropdownWindow needs to know.
2023-12-09 08:12:34 +00:00
Peter Nelson
f1cceb43a1 Codechange: Move initialization of DropdownWindow members. 2023-12-09 08:12:34 +00:00
Peter Nelson
52b121942b Codechange: DropdownWindow's selected_index is not actually an index. 2023-12-09 08:12:34 +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
89461b5561
Codechange: Don't highlight unselectable dropdown item. (#11553) 2023-12-07 16:09:45 +00:00
Peter Nelson
0434c1b474 Feature: (-tte) Add zoom level buttons to sprite aligner.
This allows for offsets to be adjusted a different zoom level than currently in use, and offset adjustment and display is also more convenient.
2023-12-04 08:14:02 +00:00
Peter Nelson
1084ab4b66 Add: Website button to Game Options window for basesets.
This links to the optional "url" item in the baseset's [metadata] section.
2023-12-03 18:52:33 +00:00
Peter Nelson
2272e8fe0e Add: Website button for Game Script settings window. 2023-12-03 18:52:33 +00:00
Peter Nelson
f60c14a682 Add: Website button for AI settings window. 2023-12-03 18:52:33 +00:00
Peter Nelson
8db7c79e79 Codechange: Add DropDownIcon constructor to override dimension.
This avoids the need to construct a DropDownIcon and set the dimension after.
2023-12-02 15:23:05 +00:00
Peter Nelson
49532914dd Change: Use CRTP-mixins to compose dropdown list items.
This allows list items to built from component parts as required, and additional
functionality is added:

* Icons and text can be positioned at the start or end of the space (templated.)
* Font size of text can be changed (templated.)
* Palette of sprites can be set (runtime.)
2023-12-02 15:23:05 +00:00
Peter Nelson
5489b9fc0c Codechange: Undo #11447, drop down list divider lines are now explicit. 2023-11-25 16:45:01 +00:00
Peter Nelson
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. (#11481)
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson
08dfe35442 Codechange: Move DropDownList height and width calculation to helper. 2023-11-13 21:30:46 +00:00
Peter Nelson
c877494f7a
Codechange: Simplify autoreplace rail/road types by using separate widget. (#11457)
This avoids needing to determine which type of list to deal with by additionally checking the window number for VEH_TRAIN/VEH_ROAD.
2023-11-13 12:32:34 +00:00
Peter Nelson
bd2ddb07ca
Change: Move baseset missing/corrupted files label to list item. (#11455)
This allows any baseset error to be displayed in the drop down list so it is more easily visible, and avoids wasted space in the layout.
2023-11-10 12:25:56 +00:00
Peter Nelson
842cf87765 Change: Bring airport picker inline with other pickers. 2023-11-07 18:27:51 +00:00
Peter Nelson
db18f60beb Change: Improve layout of road/tram stop pickers. 2023-11-07 18:27:51 +00:00
Peter Nelson
136551408c
Change: Show empty string drop down entries as divider. (#11447) 2023-11-06 22:35:01 +00:00
Peter Nelson
badce415ea Change: Add horizontal scrollbar to Industry Directory window.
This list could be very wide depending on industries and language.
2023-11-05 22:22:32 +00:00
Peter Nelson
18fb8e153f Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
Peter Nelson
d3cb6e1e67
Codechange: Call Widget::SetDirty/SetLowered directly. (#11417)
In these instances we already have the widget to hand, so don't need to look it up by index again.
2023-11-01 20:12:08 +00:00
frosch
e81313e93e Feature: Base graphics can offer parameters for additional settings. 2023-10-31 01:41:50 +01:00
Peter Nelson
129e98fbab
Fix d42a78f: Some raw drop down list strings may need token processing. (#11400)
Storing the raw string without processing though GetString() caused token
processing to be skipped.
2023-10-28 16:08:44 +01:00
Peter Nelson
a601a1f406 Change: Use modalpopup spacing for goal question windows. 2023-10-26 12:43:20 +01:00
Bernhard Reutner-Fischer
ac42dea7b2 Codechange: Remove unused parameter for Height()
DropDownListItem::Height does not need to take an argument so remove it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2023-10-21 18:53:35 +02:00
Peter Nelson
81ecbaaa33 Codechange: Hide multiplayer headers by setting width to zero.
Zero-width is how widgets are hidden elsewhere.
This removes the need for an extra array to lookup if a header is hidden.
2023-10-21 14:26:36 +01:00
Rubidium
f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 2023-10-20 23:05:43 +02:00
Peter Nelson
fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. (#11384)
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
2023-10-20 18:40:48 +01:00
Peter Nelson
f379b31e28 Add: data parameter in Window::Close method.
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
frosch
f40816503f Codechange: Add enum items for dynmically created setting dropdowns. 2023-09-20 22:35:32 +02:00
frosch
b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidium
3a2509198f Codechange: use better location for the "invalid" action sentinel value
It used to be a random sentinel for end-of-(widget-)list that was used to tell
that no action has taken place yet. Since the last action is practically the
widget that was pressed, add the sentinel to that enumeration.
2023-09-17 19:44:20 +02:00
Niels Martin Hansen
41de0d46f3 Feature: Help and manuals access window 2023-09-13 16:11:08 +02:00
Peter Nelson
e8015e497d Codechange: Use begin/end of nwidget parts of begin/length.
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.

And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Richard Wheeler
96fdfb941a
Feature: Transparency option for cost and income indicators (#11001) 2023-08-25 16:04:40 +02:00
Rubidium
eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
PeterN
d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. (#11063)
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.

Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.

This also means that strings no longer need to be formatted on every draw.
2023-06-23 08:30:13 +00:00
PeterN
b68d56d94d
Fix #11043: Don't choose toolbar dropdown option if focus is lost. (#11044)
Since dropdown menus now get closed if they lose focus, 'instant close' dropdowns (i.e. the toolbar dropdowns) should no longer execute their action to avoid unintended actions.
2023-06-20 20:34:05 +01:00
PeterN
ebc451b071
Fix #10987: Double-close of dropdown stopped land-info tool working as default. (#11000)
Clicking and releasing on the query toolbar icon is meant to select the land-info tool.

This did not work as during closing a window, OnFocusLost() is called, which then closes the window again. These two calls toggled the land-info tool one and off in the same action.

Resolve by not calling Window::Close in OnFocusLost() if the window is already closing.
2023-06-12 08:42:02 +01:00
PeterN
b49bd86a46
Fix dec7ff6b0c: Dropdowns couldn't be closed by pressing the parent button. (#10954)
Since dropdowns self-close, the detection of re-clicking a dropdown
button no longer worked, as the dropdown is already closed.

Instead set (and then test) a flag on the parent widget to indicate that
the dropdown closed. This method avoids looping windows on every click.
2023-06-07 19:01:30 +01:00
Patric Stout
3b1407d240
Feature: allow to do a hostile takeover of an AI company (in singleplayer) (#10914)
With the removal of the share-system, you could no longer make an
AI disappear in a single player game. At least, not without going
into the console.
2023-06-05 19:32:22 +02:00
Jonathan G Rennison
ec7f9f63f6 Feature: Add coverage button to waypoint window 2023-06-04 16:54:48 +01:00
Patric Stout
c43a23cea8
Fix: crash when not even a single row fits for dropdowns on low resolution screens (#10934) 2023-06-04 15:07:18 +00:00
Peter Nelson
2e62682f73 Codechange: Close dropdowns by class instead of id. 2023-06-03 14:17:05 +01:00
Peter Nelson
2511649938 Codechange: Use window parent association for dropdowns.
This replaces the separate window class and number properties, and
allows the window system to close dropdowns automatically.
2023-06-03 14:17:05 +01:00
Peter Nelson
dec7ff6b0c Fix: Make dropdowns self-close when losing focus. 2023-06-03 14:17:05 +01:00
Rubidium
3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Peter Nelson
56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Patric Stout
199e41c762
Codechange: use default dtor instead of empty (#10826) 2023-05-14 23:31:03 +02:00
Patric Stout
7634553d22 Feature: opt-in survey when exiting a game
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.

When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU

All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
Peter Nelson
f5158c8b79 Feature: Add search filter and name text to build waypoint window. 2023-05-09 23:03:14 +02:00
Peter Nelson
d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
2023-05-07 20:25:44 +01:00
PeterN
a836edd5a7
Codechange: Scrollbar::UpdatePosition() will tell if the position changed. (#10777)
So we don't need to check this manually.
2023-05-06 19:45:32 +00:00
Tyler Trahan
aa8830f57a
Feature: Filter engine build menu by name and NewGRF extra text (#10519) 2023-05-01 17:02:16 +00:00
PeterN
cc44aa7438
Change: Split Game options into General, Graphics and Sound tabs. (#10674) 2023-05-01 12:58:22 +01:00
Rubidium
c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Patric Stout
36a0818bc5
Remove: buying/selling/owning company shares (#10709) 2023-04-29 10:16:49 +02:00
Patric Stout
ed83c4b0da
Change: replace per-AI "start_date" with a global "competitors_interval" (#10653)
The per-AI "start_date" is a lot of custom code, and was rarely
used in the way it was meant.

While at it, also ported this part over to the new timer system.
2023-04-16 20:14:22 +02:00
Patric Stout
1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
Peter Nelson
e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
2023-04-13 20:57:47 +01:00
Peter Nelson
5bc9d00735 Cleanup: Let GetStringBoundingBox deal with buffer. 2023-04-13 20:57:47 +01:00
Tyler Trahan
6e52ceab96
Feature: Industry directory text filter (#10518) 2023-02-28 12:20:41 -05:00
Jonathan G Rennison
4c1406a4b5 Add: NewGRF road stops 2023-02-26 21:28:30 +01:00
glx22
b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +01:00
Didac Perez Parera
35d55bd534
Feature: Expand all towns in the scenario editor (#10215) 2022-12-25 19:42:50 +01:00
PeterN
c962c77306
Fix: Incorrect available height for dropdowns due to unsigned promotion. (#10264)
Dropdowns which are taller than the main window should automatically have
a scrollbar added. This did not work for toolbar dropdown as the location
near the top of the window resulted in an unsigned underflow.
2022-12-20 09:39:23 -05:00
Peter Nelson
33eb9688cf Add: Sprite centre and crosshair toggles on sprite aligner. 2022-12-17 15:38:28 +00:00
dP
5e14a20b3b
Feature: [GS] Scriptable league tables (#10001) 2022-11-26 18:03:03 +01:00
PeterN
6ea3e7e487
Fix #10164: Incorrect slider handle position in RTL. (#10175) 2022-11-16 19:02:51 +00:00
Peter Nelson
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 Nelson
9666e46739 Feature: Variable GUI scale.
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2022-11-12 18:28:39 +00:00
Peter Nelson
dd90d79e7b Add: Setting to toggle thin vs chunky (scaled) bevels. 2022-11-12 18:28:39 +00:00
Peter Nelson
890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson
123983743f Change: Add optional text labels to slider widget. 2022-11-12 18:28:39 +00:00
Peter Nelson
f0ae111c4a Change: Put ends of slider under centre of control knob. 2022-11-12 18:28:39 +00:00
Peter Nelson
64a1fc174f Change: Scale thickness of slider bevel. 2022-11-12 18:28:39 +00:00
Peter Nelson
1180c95372 Codechange: Add parameters to change range of slider widget. 2022-11-12 18:28:39 +00:00
Peter Nelson
d35f1d3d06 Codechange: Rename slider widget functions to be less specific. 2022-11-12 18:28:39 +00:00
Peter Nelson
6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Peter Nelson
632464a623 Codechange: Use Rect in DropDownListItem::Draw(). 2022-11-12 18:28:39 +00:00
Artin Alavi
cbac243216
Feature: [UI] Split AI/Game Script configuration windows and add them to world gen window (#10058) 2022-11-10 21:39:09 +01:00
Artin Alavi
fd4f148c62
Feature: Hotkey to honk a vehicle's horn (#10110) 2022-11-10 21:36:18 +01:00
stormcone
0d303d6c3f
Feature: Add cargo filter support to vehicle list. (#8308) 2022-11-08 21:11:16 +01:00
Aaron Kofsky
ede0560f9b
Feature: Add buttons to toggle music in the Game Options menu (#9727) 2022-11-08 18:21:52 +00:00
Peter Nelson
8626090b24 Codechange: Draw station acceptance text in its own widget. 2022-10-03 22:14:18 +01:00
Niels Martin Hansen
345dcd3c7b Add: Show current video driver info in Options window 2022-05-03 21:03:30 +02:00
Tyler Trahan
41de69c5b7 Feature: Improved Finance window 2022-04-25 21:51:51 +02:00
Charles Pigott
0853c1979b
Feature: Button to toggle showing advanced signal types (#9617) 2021-10-17 19:24:50 +01:00
Bernard Teo
20717ededf Feature: Button to open order window from VL_SHARED_ORDERS window 2021-09-18 11:17:49 +02:00