Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLayerUtils::SwitchFrameCommand Struct Reference

The SwitchFrameCommand struct Switches to frame with undo/redo support. More...

#include <kis_layer_utils.h>

+ Inheritance diagram for KisLayerUtils::SwitchFrameCommand:

Classes

struct  SharedStorage
 

Public Types

typedef QSharedPointer< SharedStorageSharedStorageSP
 
- Public Types inherited from KisCommandUtils::FlipFlopCommand
enum  State { INITIALIZING , FINALIZING }
 

Public Member Functions

 SwitchFrameCommand (KisImageSP image, int time, bool finalize, SharedStorageSP storage)
 
 ~SwitchFrameCommand () override
 
- Public Member Functions inherited from KisCommandUtils::FlipFlopCommand
 FlipFlopCommand (bool finalizing=false, KUndo2Command *parent=0)
 
 FlipFlopCommand (State initialState, KUndo2Command *parent=0)
 
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 partA () override
 
void partB () override
 

Private Attributes

KisImageWSP m_image
 
int m_newTime
 
SharedStorageSP m_storage
 

Additional Inherited Members

- Protected Member Functions inherited from KisCommandUtils::FlipFlopCommand
State getState () const
 
bool isFirstRedo () const
 

Detailed Description

The SwitchFrameCommand struct Switches to frame with undo/redo support.

Definition at line 102 of file kis_layer_utils.h.

Member Typedef Documentation

◆ SharedStorageSP

Constructor & Destructor Documentation

◆ SwitchFrameCommand()

KisLayerUtils::SwitchFrameCommand::SwitchFrameCommand ( KisImageSP image,
int time,
bool finalize,
SharedStorageSP storage )

Definition at line 1273 of file kis_layer_utils.cpp.

1274 : FlipFlopCommand(finalize),
1275 m_image(image),
1276 m_newTime(time),
1277 m_storage(storage) {}
virtual QTime time() const
FlipFlopCommand(State initialState, KUndo2Command *parent=0)

◆ ~SwitchFrameCommand()

KisLayerUtils::SwitchFrameCommand::~SwitchFrameCommand ( )
override

Definition at line 1279 of file kis_layer_utils.cpp.

1279{}

Member Function Documentation

◆ partA()

void KisLayerUtils::SwitchFrameCommand::partA ( )
overrideprivatevirtual

Reimplemented from KisCommandUtils::FlipFlopCommand.

Definition at line 1281 of file kis_layer_utils.cpp.

1281 {
1282 KisImageAnimationInterface *interface = m_image->animationInterface();
1283 const int currentTime = interface->currentTime();
1284 if (currentTime == m_newTime) {
1285 m_storage->value = m_newTime;
1286 return;
1287 }
1288
1289 interface->image()->disableUIUpdates();
1290 interface->saveAndResetCurrentTime(m_newTime, &m_storage->value);
1291 }

References m_image, m_newTime, and m_storage.

◆ partB()

void KisLayerUtils::SwitchFrameCommand::partB ( )
overrideprivatevirtual

Reimplemented from KisCommandUtils::FlipFlopCommand.

Definition at line 1293 of file kis_layer_utils.cpp.

1293 {
1294 KisImageAnimationInterface *interface = m_image->animationInterface();
1295 const int currentTime = interface->currentTime();
1296 if (currentTime == m_storage->value) {
1297 return;
1298 }
1299
1300 interface->restoreCurrentTime(&m_storage->value);
1301 interface->image()->enableUIUpdates();
1302 }
QVector< QRect > enableUIUpdates() override

References KisImage::enableUIUpdates(), m_image, and m_storage.

Member Data Documentation

◆ m_image

KisImageWSP KisLayerUtils::SwitchFrameCommand::m_image
private

Definition at line 123 of file kis_layer_utils.h.

◆ m_newTime

int KisLayerUtils::SwitchFrameCommand::m_newTime
private

Definition at line 124 of file kis_layer_utils.h.

◆ m_storage

SharedStorageSP KisLayerUtils::SwitchFrameCommand::m_storage
private

Definition at line 125 of file kis_layer_utils.h.


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