1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

PixelPaint: Show more specific Undo/Redo action text

The Undo/Redo actions now tell you what kind of action will be
undone/redone. This is achieved by adding an "action text" field to the
ImageUndoCommand and having everyone who calls did_complete_action()
provide this text.
This commit is contained in:
Andreas Kling 2022-08-21 20:33:03 +02:00
parent 101eb53de5
commit bf25b0a0b5
15 changed files with 57 additions and 20 deletions

View file

@ -31,7 +31,7 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
, m_selection(*this)
{
set_focus_policy(GUI::FocusPolicy::StrongFocus);
m_undo_stack.push(make<ImageUndoCommand>(*m_image));
m_undo_stack.push(make<ImageUndoCommand>(*m_image, String()));
m_image->add_client(*this);
set_original_rect(m_image->rect());
set_scale_bounds(0.1f, 100.0f);
@ -48,11 +48,11 @@ ImageEditor::~ImageEditor()
m_image->remove_client(*this);
}
void ImageEditor::did_complete_action()
void ImageEditor::did_complete_action(String action_text)
{
if (on_modified_change)
on_modified_change(true);
m_undo_stack.push(make<ImageUndoCommand>(*m_image));
m_undo_stack.push(make<ImageUndoCommand>(*m_image, move(action_text)));
}
bool ImageEditor::is_modified()