Undo commands for adding/removing/editing assistants/guides
CCBUG: https://bugs.kde.org/show_bug.cgi?id=361012
This MR adds undo command for assistant editing and controls the condition for merging KisChangeGuidesCommand
s. Adding multiple guides/assistants will create multiple undo commands. Removing multiple guides/assistants will create multiple undo commands. Consecutive editing of one single guide will lead to only one undo command. Consecutive editing of one assistants will lead to several commands. The list of assistants will be cloned between each adding/removing/editing, and the display properties will be shared between these clones. Changing the visual properties of guides/assistants will not create undo commands.
Test Plan
- Create a document.
- Create a guide. The undo history will have an item named "Add Guide."
- Create another guide. The undo history will have another item named "Add Guide."
- Move the first guide. The undo history will have another item named "Edit Guides."
- Disable "View->Lock Guides." No additional item added to undo history.
- Undo. Guides should still be locked and the first guide is moved to its original place.
- Redo. Guides should still be locked and the first guide's position goes back.
- Remove the first guide. The last "Edit Guides" should become "Remove Guide." (XXX)
- Undo and redo several times. There should be no errors and the position of only one guide may change per undo/redo.
- Activate "Assistant Tool."
- Create an assistant. There should be an item named "Add Assistant" in the undo history.
- Create another assistant. There should be another item named "Add Assistant" in the undo history.
- Move/Edit (change shape) the second assistant. There should be another item named "Edit Assistants."
- Toggle the visibility of the second assistant. There should be no new items.
- Remove the second assistant. There should be another item named "Remove Assistant."
- Undo/redo several times. The visibility should not change and the position of only one assistant may change per undo/redo.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. -- All libs/ui/tests passed. -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -- Many things in this file conflicts with docs.krita.org. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by tusooa the west wind