leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
281 stars 51 forks source link

[Request] Alphabetical sorting for file browsers in OpenBVE and viewer tools #1080

Open alex-wenzel opened 1 month ago

alex-wenzel commented 1 month ago

Most of the time, files aren't too difficult to find in OpenBVE itself given that most routes ship with a very small number of CSV files. However, using ObjectViewer with large object collections or trying to open some routes like the NWM Open collection, which mixes in a few hundred txt files defining various modular behaviors in the same folder as the route CSV files, can be time consuming because the files are in what appears to be a random order and span several pages of the file browser.

I'm tentatively willing to self-assign this since it's a good first issue for someone who hasn't worked with a C# project since they were first learning to code 15 years ago, but I haven't succeeded in building a working OpenBVE executable from source on my M1 MacBook yet.

leezer3 commented 1 month ago

Now that's a good point.

The order is actually whatever the filesystem is returning under the default sort rules. I suspect it it'll be alphabetically sorting on the string up-to the first space, but that's just a semi-educated guess.

I've just added testing as to whether files are valid to the GL menu (this existed in the 'classic' menu already), which should solve showing most junk files.

Sorting itself shouldn't be too difficult (...) might just require a little more thought from you or me to deal with it, as there's currently no provision in the GL menu system to re-order items at all, although I think it should be simple enough. A classic invert sort order arrow in the header for file lists I think would be relatively easy to implement, not sure off the top of my head about anything more complex.

alex-wenzel commented 1 month ago

That makes sense. I noticed that accidentally clicking on one of the non-route txt files in the NWM routes folders causes OpenBVE to freeze with an infinite color wheel that can only be terminated from Activity Monitor (on my M1 Mac), so filtering the files that are un-parsable should both improve navigation and prevent crashes like that.

I think sorting may be worth considering for ObjectViewer since the paradigm there is to have large numbers of relevant files all within the same folder.

leezer3 commented 1 month ago

OK, that's odd.

It doesn't do that on Windows. I'll have to try and test with the Hackintosh and see if that reproduces.