Improve logic for when user is asked to flatten image on save #1856
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the logic for when the user is asked whether to flatten the image when saving.
The previous logic only asked this when the file had previously been saved in a non-flat format, but now in a flat format. This logic could lead to unexpected data loss: for example, if the user opened an existing PNG, created another layer, then saved and closed Pinta, the layer information would be lost. The same applies if the user was creating a new file with several layers, then saved it as a flat format. It's not good that the user ever loses layer information without being aware of this.
After these changes, the user is asked on any save of an image with multiple layers to a flat format whether they want to flatten it.