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

#include <kis_image_layer_remove_command_impl.h>

+ Inheritance diagram for KisImageLayerRemoveCommandImpl:

Public Member Functions

 KisImageLayerRemoveCommandImpl (KisImageWSP image, KisNodeSP node, KUndo2Command *parent=0)
 
void moveChildren (KisNodeSP src, KisNodeSP dst)
 
void moveClones (KisLayerSP src, KisLayerSP dst)
 
 Private (KisImageLayerRemoveCommandImpl *_q)
 
void processClones (KisNodeSP node)
 
void redo () override
 
void restoreClones ()
 
void undo () override
 
 ~KisImageLayerRemoveCommandImpl () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisImageCommand
 KisImageCommand (const KUndo2MagicString &name, KisImageWSP image, KUndo2Command *parent=0)
 
 ~KisImageCommand () 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 ()
 

Public Attributes

QList< KisCloneLayerSPclonesList
 
KisNodeSP node
 
KisNodeSP prevAbove
 
KisNodeSP prevParent
 
KisImageLayerRemoveCommandImplq
 
QList< KisLayerSPreincarnatedNodes
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

Private *const m_d
 

Additional Inherited Members

- Protected Attributes inherited from KisImageCommand
KisImageWSP m_image
 

Detailed Description

The command for removing a single node. It should be used inside KisImageLayerRemoveCommand only

Definition at line 16 of file kis_image_layer_remove_command_impl.cpp.

Constructor & Destructor Documentation

◆ KisImageLayerRemoveCommandImpl()

KisImageLayerRemoveCommandImpl::KisImageLayerRemoveCommandImpl ( KisImageWSP image,
KisNodeSP node,
KUndo2Command * parent = 0 )

Constructor

Parameters
imageThe image the command will be working on.
nodethe node to remove

Definition at line 34 of file kis_image_layer_remove_command_impl.cpp.

35 : KisImageCommand(kundo2_i18n("Remove Layer"), image, parent),
36 m_d(new Private(this))
37{
38 m_d->node = node;
39 m_d->prevParent = node->parent();
40 m_d->prevAbove = node->prevSibling();
41}
KisImageCommand(const KUndo2MagicString &name, KisImageWSP image, KUndo2Command *parent=0)
KUndo2MagicString kundo2_i18n(const char *text)
KisNodeSP prevSibling() const
Definition kis_node.cpp:402
KisNodeWSP parent
Definition kis_node.cpp:86

References m_d, node, KisNode::parent, and KisNode::prevSibling().

◆ ~KisImageLayerRemoveCommandImpl()

KisImageLayerRemoveCommandImpl::~KisImageLayerRemoveCommandImpl ( )
override

Definition at line 43 of file kis_image_layer_remove_command_impl.cpp.

44{
45 delete m_d;
46}

References m_d.

Member Function Documentation

◆ moveChildren()

void KisImageLayerRemoveCommandImpl::moveChildren ( KisNodeSP src,
KisNodeSP dst )

◆ moveClones()

void KisImageLayerRemoveCommandImpl::moveClones ( KisLayerSP src,
KisLayerSP dst )

◆ Private()

KisImageLayerRemoveCommandImpl::Private ( KisImageLayerRemoveCommandImpl * _q)
inline

Definition at line 17 of file kis_image_layer_remove_command_impl.cpp.

17: q(_q) {}

◆ processClones()

void KisImageLayerRemoveCommandImpl::processClones ( KisNodeSP node)

◆ redo()

void KisImageLayerRemoveCommandImpl::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 48 of file kis_image_layer_remove_command_impl.cpp.

49{
51 if (!image) {
52 return;
53 }
54 m_d->processClones(m_d->node);
55 image->removeNode(m_d->node);
56}
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
bool removeNode(KisNodeSP node)

References m_d, KisImageCommand::m_image, KisNodeFacade::removeNode(), and KisWeakSharedPtr< T >::toStrongRef().

◆ restoreClones()

void KisImageLayerRemoveCommandImpl::restoreClones ( )

◆ undo()

void KisImageLayerRemoveCommandImpl::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 58 of file kis_image_layer_remove_command_impl.cpp.

59{
61 if (!image) {
62 return;
63 }
64 m_d->restoreClones(); // so that we can get prevAbove back, if it is our clone
65 image->addNode(m_d->node, m_d->prevParent, m_d->prevAbove);
66}
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)

References KisNodeFacade::addNode(), m_d, KisImageCommand::m_image, and KisWeakSharedPtr< T >::toStrongRef().

Member Data Documentation

◆ clonesList

QList<KisCloneLayerSP> KisImageLayerRemoveCommandImpl::clonesList

Definition at line 25 of file kis_image_layer_remove_command_impl.cpp.

◆ m_d

Private* const KisImageLayerRemoveCommandImpl::m_d
private

Definition at line 36 of file kis_image_layer_remove_command_impl.h.

◆ node

KisNodeSP KisImageLayerRemoveCommandImpl::node

Definition at line 21 of file kis_image_layer_remove_command_impl.cpp.

◆ prevAbove

KisNodeSP KisImageLayerRemoveCommandImpl::prevAbove

Definition at line 23 of file kis_image_layer_remove_command_impl.cpp.

◆ prevParent

KisNodeSP KisImageLayerRemoveCommandImpl::prevParent

Definition at line 22 of file kis_image_layer_remove_command_impl.cpp.

◆ q

KisImageLayerRemoveCommandImpl* KisImageLayerRemoveCommandImpl::q

Definition at line 19 of file kis_image_layer_remove_command_impl.cpp.

◆ reincarnatedNodes

QList<KisLayerSP> KisImageLayerRemoveCommandImpl::reincarnatedNodes

Definition at line 26 of file kis_image_layer_remove_command_impl.cpp.


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