rfg-modding / Nanoforge

A modding tool for Red Faction Guerilla Re-Mars-Tered
MIT License
32 stars 3 forks source link

Improve code for exit checks and save confirmation #140

Open Moneyl opened 9 months ago

Moneyl commented 9 months ago

The code for doing things like opening the save confirmation dialog when closing NF is very ugly and hard to follow. It's split across multiple classes App, Gui, Window, SaveConfirmationDialog and uses bools to trigger this logic. It needs to be improved. I think a good way to fix this would be to add some events to App related to app exits:

Should also look into using events for the logic that makes the save confirmation dialog popup appear when you close a document with unsaved changes, create a new project, or close a project. It has the same problems.

Could make a central event class or use the built in Beef Event type. Up to whoever implements this. For the second event listed above we won't be able to use Event since we need the result of each callback instead of just the final one.