MTrop / DoomTools

Doom-related tools for Java. Home of DECOHack and lots of other utilities. Build WAD projects (and soon, other kinds) with ease!
https://mtrop.github.io/DoomTools/
MIT License
46 stars 5 forks source link

[DoomTools-GUI] Try harder to remember the last directory in the "Browse files ..." dialog #107

Closed Zalewa closed 11 months ago

Zalewa commented 11 months ago

DoomTools version 2023-08-02

The "Browse files ..." dialog boxes pop-up in many different places, but more often than not they default to the "My Documents" directory. Since it's probable that the most files I'd like to browse for will be in close vicinity to each other, these dialog boxes should open starting with the last used directory.

The program should also remember those directories between sessions, or even have a list of recent workspaces available from the File menu.

MTrop commented 11 months ago

Most directory entries already do this. Do you have a specific example where the last directory selected is not saved?

Zalewa commented 11 months ago

Yes:

Open Workspace

  1. Let's say I already have a dtw workspace somewhere on disk. I turn off the program, then wish to resume the work.
  2. Run doomtools-gui.exe
  3. File | Open Workspace
  4. It always defaults to "My Documents", even though the project I last opened is far, far away from that location.

The problem is that the app doesn't remember the "previously used" workspace(s) -- either many, or just the last one if you don't feel like implementing the full file history atm.

Any editor that has already been used

This case works correctly, exactly as you say. Or, at least, I don't see any case where it doesn't, but I haven't looked everywhere.

Any editor that haven't been saved yet

Assume the workspace is already saved to some location or has just been opened from that location.

Since I operate in a workspace, I think it's most probable that the files that I wish to open or save will all be near that workspace. But all the editors that haven't been touched yet default to "My Documents", forcing me to browse back to the workspace directory.

How I think this should work

The idea is to assume that all (or most of) the files I wish to work on are located near the workspace file. So, the aim is to reduce the tedium of browsing to the workspace directory over and over again.

I think that the proper behavior would be this:

  1. If an editor remembers its own directory, and this directory still exists, the "Browse ..." dialog should default to this directory.
  2. If the workspace already has a directory, then all editors that can't apply 1. should default to the workspace directory.
  3. If neither 1. or 2. can be applied, or we have some odd case where applying either would not be appropriate, then "My Documents" is the proper default.
MTrop commented 11 months ago

Workspaces now remember the last directory/file used for saving.

Most fields are going to default to the Home or Documents folder if the browsing field is blank, and adding a global "last file" would be too cumbersome a change.

I wonder if I can make all of the fields drag-and-drop to make things a tad less painful. Hmm....

MTrop commented 11 months ago

Made 'em drag-and-drop, anyway.

Commit ca3d5eb3a1865300147a7a9af5eb2c7c6f17be27.

MTrop commented 11 months ago

I think this is as far as I'm gonna get with this issue. Closing for now.