mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
PixelPaint: Don't overwrite images with project file on save
The ImageEditor tracks whether it was loaded from an image (the alternative being a project file.) If it was loaded from an image file we redirect save project actions to save as instead.
This commit is contained in:
parent
e74e6087b0
commit
032ffbcf64
3 changed files with 12 additions and 1 deletions
|
@ -587,7 +587,7 @@ bool ImageEditor::request_close()
|
|||
|
||||
void ImageEditor::save_project()
|
||||
{
|
||||
if (path().is_empty()) {
|
||||
if (path().is_empty() || m_loaded_from_image) {
|
||||
save_project_as();
|
||||
return;
|
||||
}
|
||||
|
@ -614,6 +614,7 @@ void ImageEditor::save_project_as()
|
|||
return;
|
||||
}
|
||||
set_path(file->filename());
|
||||
set_loaded_from_image(false);
|
||||
undo_stack().set_current_unmodified();
|
||||
}
|
||||
|
||||
|
@ -649,4 +650,9 @@ void ImageEditor::set_show_active_layer_boundary(bool show)
|
|||
update();
|
||||
}
|
||||
|
||||
void ImageEditor::set_loaded_from_image(bool loaded_from_image)
|
||||
{
|
||||
m_loaded_from_image = loaded_from_image;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue