Skip to content

Make Music Selection window resizable and sortable#3384

Merged
AaronVanGeffen merged 27 commits intoOpenLoco:masterfrom
LeeSpork:sortable-music-selection
Nov 17, 2025
Merged

Make Music Selection window resizable and sortable#3384
AaronVanGeffen merged 27 commits intoOpenLoco:masterfrom
LeeSpork:sortable-music-selection

Conversation

@LeeSpork
Copy link
Copy Markdown
Contributor

@LeeSpork LeeSpork commented Nov 6, 2025

...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:
screenshot before

PR:
image

Window resized and sorted by name and by year:
image image

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

@LeeSpork LeeSpork marked this pull request as ready for review November 6, 2025 04:12
@LeeSpork
Copy link
Copy Markdown
Contributor Author

LeeSpork commented Nov 6, 2025

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.

2381: "{UINT16}-{UINT16}"
2382: "{UINT16}-"
2383: "-{UINT16}"
2384: "-"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@LeeSpork LeeSpork changed the title Make Music Selection window sortable Make Music Selection window resizable and sortable Nov 11, 2025
@LeeSpork
Copy link
Copy Markdown
Contributor Author

I have expanded the scope of this pull and added images to top comment.

@AaronVanGeffen
Copy link
Copy Markdown
Member

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?

@LeeSpork
Copy link
Copy Markdown
Contributor Author

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.
2382: "{UINT16}-"
2383: "-{UINT16}"
2384: "-"
2385: "{UINT16} music track selected"
Copy link
Copy Markdown
Contributor Author

@LeeSpork LeeSpork Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using placeholders for the singular versions of strings? The number is always 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Copy Markdown
Member

@AaronVanGeffen AaronVanGeffen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the 'Name' column to 'Title', and aligned the table headers with the scroll view for consistency. I've compensated for the checkbox and scrollbar. It looks like this now:

Screenshot 2025-11-13 at 13 38 31

@AaronVanGeffen AaronVanGeffen added this to the v25.11+ milestone Nov 13, 2025
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.
@AaronVanGeffen AaronVanGeffen force-pushed the sortable-music-selection branch from 15d6220 to f3e9dd3 Compare November 17, 2025 19:20
@AaronVanGeffen AaronVanGeffen enabled auto-merge (squash) November 17, 2025 19:21
@AaronVanGeffen AaronVanGeffen merged commit 720f64f into OpenLoco:master Nov 17, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants