summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Oppebøen <andreas.oppeboen@gmail.com>2022-11-26 22:59:10 +0100
committerSam Atkins <atkinssj@gmail.com>2022-11-30 12:18:06 +0000
commit8cca9e94a29b62aeadc75ad6d004c0fba671d6c9 (patch)
treea10ec71cc865d88eee4c9743326b2cc1a67cf1e1 /Userland
parent427d488d7e556852a2565664657dac0c4f6c9088 (diff)
downloadserenity-8cca9e94a29b62aeadc75ad6d004c0fba671d6c9.zip
PixelPaint: Record action for all select operations to allow undo
Since selections with the select tools support undo, it makes sense for the edit operations 'select all', 'none', 'invert' and 'clear selection' to also support undo.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp1
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index f9c2f2cbed..ed4cc8d627 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -426,6 +426,7 @@ void ImageEditor::keydown_event(GUI::KeyEvent& event)
if (event.key() == Key_Escape && !m_image->selection().is_empty()) {
m_image->selection().clear();
+ did_complete_action("Clear Selection"sv);
return;
}
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp
index b33c9f1829..4c546aa754 100644
--- a/Userland/Applications/PixelPaint/MainWidget.cpp
+++ b/Userland/Applications/PixelPaint/MainWidget.cpp
@@ -359,18 +359,21 @@ void MainWidget::initialize_menubar(GUI::Window& window)
if (!editor->active_layer())
return;
editor->image().selection().merge(editor->active_layer()->relative_rect(), PixelPaint::Selection::MergeMode::Set);
+ editor->did_complete_action("Select All"sv);
}));
m_edit_menu->add_action(GUI::Action::create(
"Clear &Selection", g_icon_bag.clear_selection, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().selection().clear();
+ editor->did_complete_action("Clear Selection"sv);
}));
m_edit_menu->add_action(GUI::Action::create(
"&Invert Selection", g_icon_bag.invert_selection, [&](auto&) {
auto* editor = current_image_editor();
VERIFY(editor);
editor->image().selection().invert();
+ editor->did_complete_action("Invert Selection"sv);
}));
m_edit_menu->add_separator();