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] Closing a work window with the X button loses all of its contents (too easily) #106

Closed Zalewa closed 11 months ago

Zalewa commented 11 months ago

DoomTools version 2023-08-02

The problem

I open a window, such as WTexScan, and populate it with a bunch of WADs, then hit the X button (by accident, let's say). The window is immediately gone with all of its contents. If I reopen it now, I get an empty window.

Why is it a problem?

Firstly, the program should not make it so easy to lose your work. It's easy to hit X by reflex or by missclicking the _ button, which is next to it. At the very least the window should ask for confirmation if it has any work that can be lost.

Second, I can save the workspace using the File | Save Workspace option and then restore it with File | Open Workspace and all the windows that were open at the time of the save will now be brought back with their state untouched. Now if I close one of the windows, its contents are gone again, and to retrieve them I need to File | Open Workspace again, potentially losing other changes I made in some other windows.

Proper behavior

Ideally, X shouldn't destroy the window's state, but the workspace should remember this state for as long as the workspace itself is open, and allow to reopen the window with this state intact.

I also like that you can open the same window (e.g. have 2 WTexScans open) more than once and have separate states in them, so this feature should be preserved.

MTrop commented 11 months ago

It will be easier to prompt the user on attempt to close to verify that they want to close that application. Having a default workspace state per app would be difficult in the current API.

Also, I noticed there were a few apps that didn't store workspace state properly. I'll have to look into those.

MTrop commented 11 months ago

User is now prompted to close an application. This is the best I can manage with the current state of things (no pun intended).

Added in commit 72ffd081c574bc3ce368385bf6f0011ae1168d62.