Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSurrogateUndoStore Class Reference

#include <kis_undo_stores.h>

+ Inheritance diagram for KisSurrogateUndoStore:

Public Member Functions

void addCommand (KUndo2Command *cmd) override
 
void beginMacro (const KUndo2MagicString &macroName) override
 
void clear ()
 
void endMacro () override
 
 KisSurrogateUndoStore ()
 
const KUndo2Command * presentCommand () override
 
void purgeRedoState () override
 
void redo ()
 
void redoAll ()
 
void undo ()
 
void undoAll ()
 
void undoLastCommand () override
 
 ~KisSurrogateUndoStore () override
 
- Public Member Functions inherited from KisUndoStore
 KisUndoStore ()
 
virtual ~KisUndoStore ()
 

Private Attributes

KUndo2Stack * m_undoStack
 

Additional Inherited Members

- Signals inherited from KisUndoStore
void historyStateChanged ()
 

Detailed Description

KisSurrogateUndoAdapter – saves commands directly to the internal stack. Used for wrapping around legacy code into a single command.

Definition at line 21 of file kis_undo_stores.h.

Constructor & Destructor Documentation

◆ KisSurrogateUndoStore()

KisSurrogateUndoStore::KisSurrogateUndoStore ( )

Definition at line 16 of file kis_undo_stores.cpp.

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}
KUndo2Stack * m_undoStack
void historyStateChanged()

References KisUndoStore::historyStateChanged(), and m_undoStack.

◆ ~KisSurrogateUndoStore()

KisSurrogateUndoStore::~KisSurrogateUndoStore ( )
override

Definition at line 23 of file kis_undo_stores.cpp.

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}

References KisUndoStore::historyStateChanged(), and m_undoStack.

Member Function Documentation

◆ addCommand()

void KisSurrogateUndoStore::addCommand ( KUndo2Command * cmd)
overridevirtual

Implements KisUndoStore.

Definition at line 40 of file kis_undo_stores.cpp.

41{
42 if(!command) return;
43 m_undoStack->push(command);
44}
void push(KUndo2Command *cmd)

References m_undoStack, and KUndo2QStack::push().

◆ beginMacro()

void KisSurrogateUndoStore::beginMacro ( const KUndo2MagicString & macroName)
overridevirtual

Implements KisUndoStore.

Definition at line 46 of file kis_undo_stores.cpp.

47{
48 m_undoStack->beginMacro(macroName);
49}
void beginMacro(const KUndo2MagicString &text)

References KUndo2QStack::beginMacro(), and m_undoStack.

◆ clear()

void KisSurrogateUndoStore::clear ( )

Definition at line 71 of file kis_undo_stores.cpp.

72{
74}

References KUndo2QStack::clear(), and m_undoStack.

◆ endMacro()

void KisSurrogateUndoStore::endMacro ( )
overridevirtual

Implements KisUndoStore.

Definition at line 51 of file kis_undo_stores.cpp.

52{
54}

References KUndo2QStack::endMacro(), and m_undoStack.

◆ presentCommand()

const KUndo2Command * KisSurrogateUndoStore::presentCommand ( )
overridevirtual

WARNING: All these methods are not considered as thread-safe

Implements KisUndoStore.

Definition at line 30 of file kis_undo_stores.cpp.

31{
32 return m_undoStack->command(m_undoStack->index() - 1);
33}
int index() const
const KUndo2Command * command(int index) const

References KUndo2QStack::command(), KUndo2QStack::index(), and m_undoStack.

◆ purgeRedoState()

void KisSurrogateUndoStore::purgeRedoState ( )
overridevirtual

Implements KisUndoStore.

Definition at line 66 of file kis_undo_stores.cpp.

67{
69}
void purgeRedoState()

References m_undoStack, and KUndo2QStack::purgeRedoState().

◆ redo()

void KisSurrogateUndoStore::redo ( )

Definition at line 61 of file kis_undo_stores.cpp.

62{
64}
virtual void redo()

References m_undoStack, and KUndo2QStack::redo().

◆ redoAll()

void KisSurrogateUndoStore::redoAll ( )

Definition at line 83 of file kis_undo_stores.cpp.

84{
85 while(m_undoStack->canRedo()) {
87 }
88}
bool canRedo() const

References KUndo2QStack::canRedo(), m_undoStack, and KUndo2QStack::redo().

◆ undo()

void KisSurrogateUndoStore::undo ( )

Definition at line 56 of file kis_undo_stores.cpp.

57{
59}
virtual void undo()

References m_undoStack, and KUndo2QStack::undo().

◆ undoAll()

void KisSurrogateUndoStore::undoAll ( )

Definition at line 76 of file kis_undo_stores.cpp.

77{
78 while(m_undoStack->canUndo()) {
80 }
81}
bool canUndo() const

References KUndo2QStack::canUndo(), m_undoStack, and KUndo2QStack::undo().

◆ undoLastCommand()

void KisSurrogateUndoStore::undoLastCommand ( )
overridevirtual

Implements KisUndoStore.

Definition at line 35 of file kis_undo_stores.cpp.

36{
38}

References m_undoStack, and KUndo2QStack::undo().

Member Data Documentation

◆ m_undoStack

KUndo2Stack* KisSurrogateUndoStore::m_undoStack
private

Definition at line 44 of file kis_undo_stores.h.


The documentation for this class was generated from the following files: