Peter Nelson
9a7c30a109
Codechange: Let ClickSliderWidget handle rounding to nearest mark.
2024-05-03 11:48:36 +01:00
Peter Nelson
9d2efd4c96
Codechange: Use callback function to set labels of slider widget marks.
...
Slider widgets can only use a predefined list of values and strings to draw labels. This makes it difficult to vary the display by context.
Instead of providing a predefined list as a std::map, use a callback function instead. This function can decide what text to display, and can call SetDParam to dynamically set up strings.
2024-05-03 11:48:36 +01:00
Rubidium
4f2412a272
Codechange: range based for loops instead of C-style for loops
2024-04-11 07:05:04 +02: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
d683ec0183
Codechange: Move dropdown and slider out of widgets directory. ( #12403 )
...
Also shuffle headers to place widget includes near end.
This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01: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
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
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
6f35f3274f
Fix ab1a4c6c: Crash if the "No Music" set is loaded because there is no current set_index. ( #11511 )
...
Add a helper function to get the current set_index which which checks it is in range.
2023-11-29 02:30:10 +00:00
Peter Nelson
519fe33175
Fix ab1a4c6c: Changing baseset/playlist while shuffle is on does not change song. ( #11510 )
...
The change-playlist function relied on toggling shuffle to restart playing which is no longer the case, so always handle it when changing playlist instead.
2023-11-28 17:44:31 +00:00
Peter Nelson
ab1a4c6c80
Change: Don't restart playback when toggling playlist shuffle.
...
Instead update the selected playlist entry for the current song.
2023-11-27 23:16:41 +00:00
Peter Nelson
6c91c4b99d
Fix: Invalidate playlist window when (un)shuffling playlist.
2023-11-27 23:16:41 +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
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
frosch
0b7ecf6102
Codechange: use the shortname as unique id to identify the base graphics in openttd.cfg.
2023-10-31 01:41:50 +01:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
2023-09-16 23:09:53 +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
glx22
46b504a700
Fix: ini_key issues reported by the script
2023-07-14 14:32:46 +02:00
merni-ns
161cc04b8a
Fix #11087 : Disable base graphics/sound dropdown outside main menu
2023-07-01 19:03:45 +02: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
e6740046ee
Codechange: Use range-for iteration.
2023-05-11 07:58:55 +01:00
Rubidium
68ff3fd062
Change: include fmt.h C++ headers in stdafx.h
...
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +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
e999aa2923
Fix: Don't (briefly) switch from title-only playlist on menu screen.
...
Switching playlist while on the menu screen now only changes the playlist
that will be used when out of the menu screen.
2023-03-09 20:35:24 +00:00
Peter Nelson
3b90b85439
Change: Allow jukebox lists to fill window width.
2023-03-09 20:35:24 +00:00
Peter Nelson
0c4e2ce114
Change: Resize jukebox when changing music set.
2023-03-09 20:35:24 +00:00
Peter Nelson
1ec34acb51
Fix: Truncated music-set song names cause warning log.
...
The music-set does not need to be selected for this to occur.
Resolved by using std::string instead of fixed buffer for song names,
which avoids manual string copying and removes the length limit.
2023-03-09 20:35:24 +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
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
b6ed595176
Codechange: Prefer suggested widget padding.
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
Jonathan G Rennison
0fae0599b7
Fix: Data race on effect volume setting with mixer thread
2022-11-11 23:48:24 +01:00
PeterN
0bac74ec2b
Fix #10038 : Missing upper bounds check when loading custom playlists ( #10039 )
2022-09-21 08:31:59 +01:00
Peter Nelson
8321ef0061
Codechange: Set specific widgets dirty instead of window.
2021-05-08 09:52:54 +01:00
rubidium42
6bca9e090d
Codechange: add SetDParamStr that accepts std::string&
2021-05-06 21:45:36 +02:00
Niels Martin Hansen
785e42a6f9
Feature: Volume sliders in Game Options window
2021-04-09 12:18:52 +02:00
Niels Martin Hansen
88c92f7b7c
Codechange: Move volume control slider logic to separate functions
2021-04-09 12:18:52 +02:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
2021-01-08 11:16:18 +01:00
Michael Lutz
a49fdb7ebb
Codechange: Store base set related texts in std::strings.
2020-05-21 20:02:34 +02:00
Milek7
a411ce18c9
Fix: avoid using string pointer after scope end
2020-01-12 15:20:08 +01:00
Niels Martin Hansen
f02b643a44
Change: Show volume sliders with wedges instead of boxy slider
2020-01-07 18:13:58 +01:00
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
2019-11-10 17:59:20 +00:00
Michael Lutz
c7b9987d08
Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
...
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
2019-04-09 22:45:15 +02:00
peter1138
317f69c152
Codechange: Use override specifier in Window-derived classes.
2019-03-24 16:10:04 +01:00
Peter Nelson
6dfe36b5cd
Change: Make volume slider widget capture mouse when clicked.
...
This makes the slider continue to respond even when mouse cursor
is no longer over the widget.
2019-02-21 08:11:35 +00:00
Niels Martin Hansen
c618a7c093
Fix 6298b96: Changing music set did not save new setting
2018-11-25 00:47:56 +01:00