Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Model::NoteNodeChange Class Reference
Inheritance diagram for Model::NoteNodeChange:
Model::UndoCommand

Public Member Functions

 NoteNodeChange (QSet< Node * > &modifiedTargets, QSet< Node * > &removedTargets, const UndoCommand *command)
 
virtual void redo ()
 
virtual void undo ()
 
- Public Member Functions inherited from Model::UndoCommand
 UndoCommand (Node *target, const QString &text)
 
virtual ~UndoCommand ()
 
virtual NodeinsertedNode () const
 Returns the node that this command inserted into the tree, or nullptr if no node was inserted. More...
 
bool isUndone () const
 Returns whether the command has been undone since it was applied. More...
 
virtual Nodeowned () const
 Returns the node owned by this command or nullptr if no node is owned. More...
 
virtual NoderemovedNode () const
 Returns the node that this command removed from the tree, or nullptr if no node was removed. More...
 
Nodetarget () const
 

Private Member Functions

void markNodeAndChildrenAsRemoved (Node *node) const
 
void unmarkRemovals (Node *insertedNode) const
 It could happen than a subtree which is removed earlier in the undostack, is reinserted at a later time in the command stack. More...
 

Private Attributes

NodeinsertedNode_ {}
 
QSet< Node * > & modifiedTargets_
 
NoderemovedNode_ {}
 
QSet< Node * > & removedTargets_
 
Nodetarget_ {}
 

Constructor & Destructor Documentation

◆ NoteNodeChange()

Model::NoteNodeChange::NoteNodeChange ( QSet< Node * > &  modifiedTargets,
QSet< Node * > &  removedTargets,
const UndoCommand command 
)

Member Function Documentation

◆ markNodeAndChildrenAsRemoved()

void Model::NoteNodeChange::markNodeAndChildrenAsRemoved ( Node node) const
private

◆ redo()

void Model::NoteNodeChange::redo ( )
virtual

Reimplemented from Model::UndoCommand.

◆ undo()

void Model::NoteNodeChange::undo ( )
virtual

Reimplemented from Model::UndoCommand.

◆ unmarkRemovals()

void Model::NoteNodeChange::unmarkRemovals ( Node insertedNode) const
private

It could happen than a subtree which is removed earlier in the undostack, is reinserted at a later time in the command stack.

In such cases we should not report these nodes as removed. (MAYBE)

TODO: Think about whether we:

  • should not report nodes which have been essentially moved in any way
  • should report moved nodes in some special way
  • should report moved nodes as a pair of deletion/insertion

Member Data Documentation

◆ insertedNode_

Node* Model::NoteNodeChange::insertedNode_ {}
private

◆ modifiedTargets_

QSet<Node*>& Model::NoteNodeChange::modifiedTargets_
private

◆ removedNode_

Node* Model::NoteNodeChange::removedNode_ {}
private

◆ removedTargets_

QSet<Node*>& Model::NoteNodeChange::removedTargets_
private

◆ target_

Node* Model::NoteNodeChange::target_ {}
private