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

#include <kis_set_layer_style_command.h>

+ Inheritance diagram for KisSetLayerStyleCommand:

Public Member Functions

 KisSetLayerStyleCommand (KisLayerSP layer, KisPSDLayerStyleSP oldStyle, KisPSDLayerStyleSP newStyle, 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 ()
 

Static Public Member Functions

static void updateLayerStyle (KisLayerSP layer, KisPSDLayerStyleSP style)
 

Private Attributes

KisLayerSP m_layer
 
KisPSDLayerStyleSP m_newStyle
 
KisPSDLayerStyleSP m_oldStyle
 

Detailed Description

Definition at line 16 of file kis_set_layer_style_command.h.

Constructor & Destructor Documentation

◆ KisSetLayerStyleCommand()

KisSetLayerStyleCommand::KisSetLayerStyleCommand ( KisLayerSP layer,
KisPSDLayerStyleSP oldStyle,
KisPSDLayerStyleSP newStyle,
KUndo2Command * parent = 0 )

Definition at line 14 of file kis_set_layer_style_command.cpp.

15 : KUndo2Command(kundo2_i18n("Change Layer Style"), parent),
16 m_layer(layer),
17 m_oldStyle(oldStyle),
18 m_newStyle(newStyle)
19{
20}
KUndo2Command(KUndo2Command *parent=0)
KUndo2MagicString kundo2_i18n(const char *text)

Member Function Documentation

◆ redo()

void KisSetLayerStyleCommand::redo ( )
overridevirtual

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 22 of file kis_set_layer_style_command.cpp.

23{
25}
static void updateLayerStyle(KisLayerSP layer, KisPSDLayerStyleSP style)

References m_layer, m_newStyle, and updateLayerStyle().

◆ undo()

void KisSetLayerStyleCommand::undo ( )
overridevirtual

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 27 of file kis_set_layer_style_command.cpp.

References m_layer, m_oldStyle, and updateLayerStyle().

◆ updateLayerStyle()

void KisSetLayerStyleCommand::updateLayerStyle ( KisLayerSP layer,
KisPSDLayerStyleSP style )
static

Definition at line 32 of file kis_set_layer_style_command.cpp.

33{
34 QRect oldDirtyRect = layer->projectionPlane()->changeRect(layer->extent(), KisLayer::N_FILTHY);
35 layer->setLayerStyle(style);
36 QRect newDirtyRect = layer->projectionPlane()->changeRect(layer->extent(), KisLayer::N_FILTHY);
37
38 layer->setDirty(newDirtyRect | oldDirtyRect);
39}
QRect extent() const override
void setLayerStyle(KisPSDLayerStyleSP layerStyle)
Definition kis_layer.cc:254
KisLayerProjectionPlaneSP projectionPlane
Definition kis_layer.cc:174
@ N_FILTHY
Definition kis_node.h:61
virtual void setDirty()
Definition kis_node.cpp:577

References KisLayer::extent(), KisNode::N_FILTHY, KisLayer::projectionPlane, KisNode::setDirty(), and KisLayer::setLayerStyle().

Member Data Documentation

◆ m_layer

KisLayerSP KisSetLayerStyleCommand::m_layer
private

Definition at line 27 of file kis_set_layer_style_command.h.

◆ m_newStyle

KisPSDLayerStyleSP KisSetLayerStyleCommand::m_newStyle
private

Definition at line 29 of file kis_set_layer_style_command.h.

◆ m_oldStyle

KisPSDLayerStyleSP KisSetLayerStyleCommand::m_oldStyle
private

Definition at line 28 of file kis_set_layer_style_command.h.


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