summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-22 19:08:00 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-22 21:55:19 +0200
commitd7cf36ec6c2b2f43b9e2aa6c335fff92b236747a (patch)
treeec7a83f57904563890bdfce0c4eb70ded25fc7d4 /Userland/Applications/PixelPaint
parent32b73dd4aff4bfa5fd63e16a60fae1130c34a26c (diff)
downloadserenity-d7cf36ec6c2b2f43b9e2aa6c335fff92b236747a.zip
PixelPaint: Create undo items for more editing actions
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp
index b3f070f7a3..ad3fd8b008 100644
--- a/Userland/Applications/PixelPaint/MainWidget.cpp
+++ b/Userland/Applications/PixelPaint/MainWidget.cpp
@@ -510,12 +510,14 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().flip(Gfx::Orientation::Vertical);
+ editor->did_complete_action("Flip Image Vertically"sv);
}));
m_image_menu->add_action(GUI::Action::create(
"Flip &Horizontally", g_icon_bag.edit_flip_horizontal, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().flip(Gfx::Orientation::Horizontal);
+ editor->did_complete_action("Flip Image Horizontally"sv);
}));
m_image_menu->add_separator();
@@ -524,6 +526,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().rotate(Gfx::RotationDirection::CounterClockwise);
+ editor->did_complete_action("Rotate Image Counterclockwise"sv);
}));
m_image_menu->add_action(GUI::CommonActions::make_rotate_clockwise_action(
@@ -531,6 +534,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().rotate(Gfx::RotationDirection::Clockwise);
+ editor->did_complete_action("Rotate Image Clockwise"sv);
}));
m_image_menu->add_separator();
m_image_menu->add_action(GUI::Action::create(
@@ -538,11 +542,13 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto* editor = current_image_editor();
VERIFY(editor);
auto dialog = PixelPaint::ResizeImageDialog::construct(editor->image().size(), &window);
- if (dialog->exec() == GUI::Dialog::ExecResult::OK)
+ if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
editor->image().resize(dialog->desired_size(), dialog->scaling_mode());
+ editor->did_complete_action("Resize Image"sv);
+ }
}));
m_image_menu->add_action(GUI::Action::create(
- "&Crop To Selection", g_icon_bag.crop, [&](auto&) {
+ "&Crop to Selection", g_icon_bag.crop, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
// FIXME: disable this action if there is no selection
@@ -551,6 +557,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto crop_rect = editor->image().rect().intersected(editor->selection().bounding_rect());
editor->image().crop(crop_rect);
editor->selection().clear();
+ editor->did_complete_action("Crop to Selection"sv);
}));
m_layer_menu = window.add_menu("&Layer");