Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_undo_stores.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "kis_undo_stores.h"
8
9#include <kundo2stack.h>
10
11
12/*****************************************************************/
13/* KisSurrogateUndoStore */
14/*****************************************************************/
15
17 : m_undoStack(new KUndo2Stack)
18{
19 // Use direct connection to avoid queueing the signal forwarding (BUG:447985)
20 connect(m_undoStack, SIGNAL(indexChanged(int)), this, SIGNAL(historyStateChanged()), Qt::DirectConnection);
21}
22
24{
25 // disconnect the signal to avoid the it being emitted on destruction
26 disconnect(m_undoStack, SIGNAL(indexChanged(int)), this, SIGNAL(historyStateChanged()));
27 delete m_undoStack;
28}
29
34
39
41{
42 if(!command) return;
43 m_undoStack->push(command);
44}
45
47{
48 m_undoStack->beginMacro(macroName);
49}
50
55
60
65
70
75
77{
78 while(m_undoStack->canUndo()) {
80 }
81}
82
84{
85 while(m_undoStack->canRedo()) {
87 }
88}
89
90
91/*****************************************************************/
92/* KisDumbUndoStore */
93/*****************************************************************/
94
96{
97 return 0;
98}
99
108
110{
114 command->redo();
115 delete command;
116
117 Q_EMIT historyStateChanged();
118}
119
121{
125 Q_UNUSED(macroName);
126}
127
129{
134 Q_EMIT historyStateChanged();
135}
136
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
virtual void redo()
void beginMacro(const KUndo2MagicString &text)
virtual void undo()
bool canUndo() const
void push(KUndo2Command *cmd)
bool canRedo() const
virtual void redo()
int index() const
void purgeRedoState()
const KUndo2Command * command(int index) const
void undoLastCommand() override
void purgeRedoState() override
void addCommand(KUndo2Command *cmd) override
void endMacro() override
void beginMacro(const KUndo2MagicString &macroName) override
const KUndo2Command * presentCommand() override
void purgeRedoState() override
KUndo2Stack * m_undoStack
void addCommand(KUndo2Command *cmd) override
const KUndo2Command * presentCommand() override
void beginMacro(const KUndo2MagicString &macroName) override
void undoLastCommand() override
void historyStateChanged()