Make Music Selection window resizable and sortable#3384
Make Music Selection window resizable and sortable#3384AaronVanGeffen merged 27 commits intoOpenLoco:masterfrom
Conversation
No UI for it yet, but the sort mode can now be changed and it will work properly.
|
Note that this window is only available for "Play customised selection of music" mode, which the current game year is irrelevant to. Showing the years is however still nice for the purpose of helping players find the tracks they want. |
Name asc/desc order is still reverse of what you would expect from alphabetical, but this is consistent with tables in other windows across OpenLoco.
data/language/en-GB.yml
Outdated
| 2381: "{UINT16}-{UINT16}" | ||
| 2382: "{UINT16}-" | ||
| 2383: "-{UINT16}" | ||
| 2384: "-" |
There was a problem hiding this comment.
This last one could be changed to e.g. "All years". Although, the condition for this string to be shown is not present in any of the vanilla music tracks, and is unlikely to come up in any new music, so not having this string at all might also be reasonable.
|
I have expanded the scope of this pull and added images to top comment. |
|
With the resize handle requiring some space at the bottom, I'm thinking it might be nice to show the number of tracks selected at the bottom of the window. What do you think? |
|
That sounds like a good idea! |
Also fixes a mistake I introduced earlier in this branch that could cause a crash when clicking beyond last the row in the scrollview.
data/language/en-GB.yml
Outdated
| 2382: "{UINT16}-" | ||
| 2383: "-{UINT16}" | ||
| 2384: "-" | ||
| 2385: "{UINT16} music track selected" |
There was a problem hiding this comment.
Why are we using placeholders for the singular versions of strings? The number is always 1
There was a problem hiding this comment.
Uniformity, I suppose. Eventually, we'd like to extend support for languages that don't have a binary singular/plural system. That would likely see us making it one string that encompasses all cases. (This might be 1 (CJK), 2 (singular/plural), or several.)
Seems to fix for this window OpenLoco#3422
The corrections in makeWidgets doesn't actually matter as onResize gets called for whatever reason anyway, but it makes me happy.
`, left{ static_cast<int16_t>(origin.x) }`
`, right{ static_cast<int16_t>(origin.x + size.width - 1) }`
- Widget.h
→ Need to add one when defining the left based on the right to get a desired width.
15d6220 to
f3e9dd3
Compare

...And display the time period associated with each track.
Allows the user to sort the music its name or its start/end years in the Edit Music Selection window. Clicking the table headers cycles between descending, ascending, and the original order that vanilla used. Name column is ascending first, years column is descending first.
Also makes the window resizable, and adds a status bar.
Screenshots

OpenLoco v25.11, for reference:
PR:

Window resized and sorted by name and by year:

Additional information
This is partially based on an ancient closed pull of mine, #2695