Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaintDevice::Private::FrameInsertionCommand Class Reference
+ Inheritance diagram for KisPaintDevice::Private::FrameInsertionCommand:

Public Member Functions

 FrameInsertionCommand (FramesHash *hash, DataSP data, int frameId, bool insert, KUndo2Command *parentCommand)
 
void redo () override
 
void undo () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Commandchild (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraDataextraData () const
 
bool hasParent () const
 
virtual int id () const
 
virtual bool isMerged () const
 
 KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 KUndo2Command (KUndo2Command *parent=0)
 
virtual QVector< KUndo2Command * > mergeCommandsVector () const
 
virtual bool mergeWith (const KUndo2Command *other)
 
virtual void redoMergedCommands ()
 
void setEndTime ()
 
virtual void setEndTime (const QTime &time)
 
void setExtraData (KUndo2CommandExtraData *data)
 
void setText (const KUndo2MagicString &text)
 
void setTime ()
 
virtual void setTime (const QTime &time)
 
virtual void setTimedID (int timedID)
 
KUndo2MagicString text () const
 
virtual QTime time () const
 
virtual int timedId () const
 
virtual bool timedMergeWith (KUndo2Command *other)
 
virtual void undoMergedCommands ()
 
virtual ~KUndo2Command ()
 

Private Member Functions

void doSwap (bool insert)
 

Private Attributes

DataSP m_data
 
int m_frameId
 
FramesHashm_hash
 
bool m_insert
 

Detailed Description

Definition at line 234 of file kis_paint_device.cc.

Constructor & Destructor Documentation

◆ FrameInsertionCommand()

KisPaintDevice::Private::FrameInsertionCommand::FrameInsertionCommand ( FramesHash * hash,
DataSP data,
int frameId,
bool insert,
KUndo2Command * parentCommand )
inline

Member Function Documentation

◆ doSwap()

void KisPaintDevice::Private::FrameInsertionCommand::doSwap ( bool insert)
inlineprivate

Definition at line 258 of file kis_paint_device.cc.

259 {
260 if (insert) {
261 m_hash->insert(m_frameId, m_data);
262 } else {
263 DataSP deletedData = m_hash->take(m_frameId);
264 }
265 }
QSharedPointer< Data > DataSP

References m_data, m_frameId, and m_hash.

◆ redo()

void KisPaintDevice::Private::FrameInsertionCommand::redo ( )
inlineoverridevirtual

Applies a change to the document. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from KUndo2Command.

Definition at line 247 of file kis_paint_device.cc.

References doSwap(), and m_insert.

◆ undo()

void KisPaintDevice::Private::FrameInsertionCommand::undo ( )
inlineoverridevirtual

Reverts a change to the document. After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls undo() on all child commands in reverse order.

See also
redo()

Reimplemented from KUndo2Command.

Definition at line 252 of file kis_paint_device.cc.

253 {
255 }

References doSwap(), and m_insert.

Member Data Documentation

◆ m_data

DataSP KisPaintDevice::Private::FrameInsertionCommand::m_data
private

Definition at line 269 of file kis_paint_device.cc.

◆ m_frameId

int KisPaintDevice::Private::FrameInsertionCommand::m_frameId
private

Definition at line 270 of file kis_paint_device.cc.

◆ m_hash

FramesHash* KisPaintDevice::Private::FrameInsertionCommand::m_hash
private

Definition at line 268 of file kis_paint_device.cc.

◆ m_insert

bool KisPaintDevice::Private::FrameInsertionCommand::m_insert
private

Definition at line 271 of file kis_paint_device.cc.


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