Skip to content

Warn when exporting to a flat format#910

Merged
cameronwhite merged 12 commits into
PintaProject:masterfrom
Matthieu-LAURENT39:flat_format_warn
Jul 6, 2024
Merged

Warn when exporting to a flat format#910
cameronwhite merged 12 commits into
PintaProject:masterfrom
Matthieu-LAURENT39:flat_format_warn

Conversation

@Matthieu-LAURENT39

Copy link
Copy Markdown
Contributor

This fixes #909

Note that this is my first time using C# and GTK, so the code quality might be subpar.
Don't hesitate to point me in the right direction and ask for changes.

This was done so that it would prompt if a user was working on an already saved flat file format, then added layers and saved again
@Matthieu-LAURENT39 Matthieu-LAURENT39 marked this pull request as ready for review July 5, 2024 10:14
@Lehonti

Lehonti commented Jul 5, 2024

Copy link
Copy Markdown
Contributor

One thing you could do is adding your change to CHANGELOG.md :)

And great idea, by the way

@Matthieu-LAURENT39

Copy link
Copy Markdown
Contributor Author

One thing you could do is adding your change to CHANGELOG.md :)

And great idea, by the way

Sure thing!
I'm not too sure whether to put it under "added" or "changed" though

Comment thread CHANGELOG.md Outdated
Comment thread Pinta.Core/Managers/ImageConverterManager.cs Outdated
Comment thread Pinta/Actions/File/SaveDocumentImplementationAction.cs Outdated
}

// If the format doesn't support layers, ask to flatten the image
if (!format.SupportsLayers && document.Layers.Count() > 1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this prompt always show up if there are multiple layers might be too annoying / confusing for common cases where users just want to save to a .png / jpeg and don't care about preserving layers.
I think limiting it to only appearing if the previous file type did support layers (e.g. .ora) would probably be a safer starting point

@Matthieu-LAURENT39 Matthieu-LAURENT39 Jul 6, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree prompting might be a bit excessive in that case.
Should we still execute the flatten action though?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I'd probably skip the flatten action and just do it implicitly, so the behaviour is unchanged for the common case

@Matthieu-LAURENT39 Matthieu-LAURENT39 marked this pull request as draft July 6, 2024 11:01
Comment thread Pinta/Actions/File/SaveDocumentImplementationAction.cs
@Matthieu-LAURENT39 Matthieu-LAURENT39 marked this pull request as ready for review July 6, 2024 18:45
@cameronwhite

Copy link
Copy Markdown
Member

Looks good! Could you just fix the formatting issues that are causing the CI build to fail? Running dotnet format should work

@Lehonti

Lehonti commented Jul 6, 2024

Copy link
Copy Markdown
Contributor

@Matthieu-LAURENT39 in order for the errors to disappear, you could try checking the indentation and checking that the line endings are consistent (that is, no mixing LF with CR LF). If you are using Visual Studio you could try Ctrl+K and then Ctrl+D

@Matthieu-LAURENT39

Matthieu-LAURENT39 commented Jul 6, 2024

Copy link
Copy Markdown
Contributor Author

Looks good! Could you just fix the formatting issues that are causing the CI build to fail? Running dotnet format should work

done!

@Matthieu-LAURENT39 in order for the errors to disappear, you could try checking the indentation and checking that the line endings are consistent (that is, no mixing LF with CR LF). If you are using Visual Studio you could try Ctrl+K and then Ctrl+D

i tried to change it, but i'm pretty sure it was already all LF. Git didn't detect any changes that i could commit at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exporting to a flat format should warn you

3 participants