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< SharedStorage > SharedStorageSP
 
- 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 KUndo2Command * child (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraData * extraData () 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 108 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 1304 of file kis_layer_utils.cpp.

1305 : FlipFlopCommand(finalize),
1306 m_image(image),
1307 m_newTime(time),
1308 m_storage(storage) {}
virtual QTime time() const
FlipFlopCommand(State initialState, KUndo2Command *parent=0)

◆ ~SwitchFrameCommand()

KisLayerUtils::SwitchFrameCommand::~SwitchFrameCommand ( )
override

Definition at line 1310 of file kis_layer_utils.cpp.

1310{}

Member Function Documentation

◆ partA()

void KisLayerUtils::SwitchFrameCommand::partA ( )
overrideprivatevirtual

Reimplemented from KisCommandUtils::FlipFlopCommand.

Definition at line 1312 of file kis_layer_utils.cpp.

1312 {
1313 KisImageAnimationInterface *interface = m_image->animationInterface();
1314 const int currentTime = interface->currentTime();
1315 if (currentTime == m_newTime) {
1316 m_storage->value = m_newTime;
1317 return;
1318 }
1319
1320 interface->image()->disableUIUpdates();
1321 interface->saveAndResetCurrentTime(m_newTime, &m_storage->value);
1322 }

References m_image, m_newTime, and m_storage.

◆ partB()

void KisLayerUtils::SwitchFrameCommand::partB ( )
overrideprivatevirtual

Reimplemented from KisCommandUtils::FlipFlopCommand.

Definition at line 1324 of file kis_layer_utils.cpp.

1324 {
1325 KisImageAnimationInterface *interface = m_image->animationInterface();
1326 const int currentTime = interface->currentTime();
1327 if (currentTime == m_storage->value) {
1328 return;
1329 }
1330
1331 interface->restoreCurrentTime(&m_storage->value);
1332 interface->image()->enableUIUpdates();
1333 }
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 129 of file kis_layer_utils.h.

◆ m_newTime

int KisLayerUtils::SwitchFrameCommand::m_newTime
private

Definition at line 130 of file kis_layer_utils.h.

◆ m_storage

SharedStorageSP KisLayerUtils::SwitchFrameCommand::m_storage
private

Definition at line 131 of file kis_layer_utils.h.


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