|
Krita Source Code Documentation
|
Inheritance diagram for UndoStack:Classes | |
| struct | PostponedJob |
Public Member Functions | |
| void | notifySetIndexChangedOneCommand () override |
| void | redo () override |
| void | setIndex (int idx) override |
| void | undo () override |
| UndoStack (KisDocument *doc) | |
Public Member Functions inherited from KUndo2Stack | |
| QAction * | createRedoAction (KisKActionCollection *actionCollection, const QString &actionName=QString()) |
| QAction * | createUndoAction (KisKActionCollection *actionCollection, const QString &actionName=QString()) |
| KUndo2Stack (QObject *parent=0) | |
Public Member Functions inherited from KUndo2QStack | |
| QString | actionText (int idx) const |
| void | beginMacro (const KUndo2MagicString &text) |
| bool | canRedo () const |
| bool | canUndo () const |
| int | cleanIndex () const |
| void | clear () |
| const KUndo2Command * | command (int index) const |
| int | count () const |
| QAction * | createRedoAction (QObject *parent) const |
| QAction * | createUndoAction (QObject *parent) const |
| KisCumulativeUndoData | cumulativeUndoData () |
| void | endMacro () |
| int | index () const |
| bool | isActive () const |
| bool | isClean () const |
| KUndo2QStack (QObject *parent=0) | |
| void | push (KUndo2Command *cmd) |
| QString | redoText () const |
| void | setCumulativeUndoData (const KisCumulativeUndoData &data) |
| void | setUndoLimit (int limit) |
| void | setUseCumulativeUndoRedo (bool value) |
| QString | text (int idx) const |
| int | undoLimit () const |
| QString | undoText () const |
| bool | useCumulativeUndoRedo () const |
| ~KUndo2QStack () override | |
Private Member Functions | |
| KisImageWSP | image () |
| void | processPostponedJobs () |
| void | redoImpl () |
| void | setIndexImpl (int idx) |
| void | undoImpl () |
Private Attributes | |
| KisDocument * | m_doc |
| QQueue< PostponedJob > | m_postponedJobs |
| int | m_recursionCounter = 0 |
Additional Inherited Members | |
Public Slots inherited from KUndo2QStack | |
| void | purgeRedoState () |
| void | setActive (bool active=true) |
| void | setClean () |
Signals inherited from KUndo2QStack | |
| void | canRedoChanged (bool canRedo) |
| void | canUndoChanged (bool canUndo) |
| void | cleanChanged (bool clean) |
| void | indexChanged (int idx) |
| void | redoTextChanged (const QString &redoActionText) |
| void | undoTextChanged (const QString &undoActionText) |
Properties inherited from KUndo2QStack | |
| bool | active |
| the active status of this stack. | |
| int | undoLimit |
| the maximum number of commands on this stack. | |
Definition at line 168 of file KisDocument.cpp.
|
inline |
Definition at line 171 of file KisDocument.cpp.
|
inlineprivate |
Definition at line 208 of file KisDocument.cpp.
References KisDocument::image, and m_doc.
|
inlineoverridevirtual |
Called by setIndex after every command execution. It is needed by Krita to insert barriers between different kind of commands
Some very weird commands may Q_EMIT blocking signals to the GUI (e.g. KisGuiContextCommand). Here is the best thing we can do to avoid the deadlock
Reimplemented from KUndo2QStack.
Definition at line 182 of file KisDocument.cpp.
References image(), KisImage::tryBarrierLock(), and KisImage::unlock().
|
inlineprivate |
Some undo commands may call QApplication::processEvents(), see notifySetIndexChangedOneCommand(). That may cause recursive calls to the undo stack methods when used from the Undo History docker. Here we try to handle that gracefully by accumulating all the requests and executing them at the topmost level of recursion.
Definition at line 247 of file KisDocument.cpp.
References UndoStack::PostponedJob::index, m_postponedJobs, m_recursionCounter, UndoStack::PostponedJob::Redo, redoImpl(), UndoStack::PostponedJob::SetIndex, setIndexImpl(), UndoStack::PostponedJob::type, UndoStack::PostponedJob::Undo, and undoImpl().
|
inlineoverridevirtual |
Redoes the current command by calling KUndo2Command::redo(). Increments the current command index.
If the stack is empty, or if the top command on the stack has already been redone, this function does nothing.
Reimplemented from KUndo2QStack.
Definition at line 202 of file KisDocument.cpp.
References m_postponedJobs, processPostponedJobs(), and UndoStack::PostponedJob::Redo.
|
inlineprivate |
Definition at line 237 of file KisDocument.cpp.
References image(), KUndo2QStack::redo(), KisImage::requestRedoDuringStroke(), KisImage::tryBarrierLock(), and KisImage::unlock().
|
inlineoverridevirtual |
Repeatedly calls undo() or redo() until the current command index reaches idx. This function can be used to roll the state of the document forwards of backwards. indexChanged() is emitted only once.
Reimplemented from KUndo2QStack.
Definition at line 177 of file KisDocument.cpp.
References m_postponedJobs, processPostponedJobs(), and UndoStack::PostponedJob::SetIndex.
|
inlineprivate |
Definition at line 214 of file KisDocument.cpp.
References image(), KisImage::requestStrokeCancellation(), KUndo2QStack::setIndex(), KisImage::tryBarrierLock(), and KisImage::unlock().
|
inlineoverridevirtual |
Undoes the command below the current command by calling KUndo2Command::undo(). Decrements the current command index.
If the stack is empty, or if the bottom command on the stack has already been undone, this function does nothing.
Reimplemented from KUndo2QStack.
Definition at line 196 of file KisDocument.cpp.
References m_postponedJobs, processPostponedJobs(), and UndoStack::PostponedJob::Undo.
|
inlineprivate |
Definition at line 223 of file KisDocument.cpp.
References image(), KisImage::requestUndoDuringStroke(), KisImage::tryBarrierLock(), KisImage::tryUndoUnfinishedLod0Stroke(), KUndo2QStack::undo(), UNDO_OK, and KisImage::unlock().
|
private |
Definition at line 292 of file KisDocument.cpp.
|
private |
Definition at line 290 of file KisDocument.cpp.
|
private |
Definition at line 279 of file KisDocument.cpp.