global: made every user action set a project "modified" state that will prevent
the main window from closing instantly
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "nodeviewundo.h"
|
||||
|
||||
NodeEdgeAddCommand::NodeEdgeAddCommand(NodeOutput *output, NodeInput *input, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
output_(output),
|
||||
input_(input),
|
||||
old_edge_(nullptr),
|
||||
@@ -9,7 +9,7 @@ NodeEdgeAddCommand::NodeEdgeAddCommand(NodeOutput *output, NodeInput *input, QUn
|
||||
{
|
||||
}
|
||||
|
||||
void NodeEdgeAddCommand::redo()
|
||||
void NodeEdgeAddCommand::redo_internal()
|
||||
{
|
||||
if (done_) {
|
||||
return;
|
||||
@@ -22,7 +22,7 @@ void NodeEdgeAddCommand::redo()
|
||||
done_ = true;
|
||||
}
|
||||
|
||||
void NodeEdgeAddCommand::undo()
|
||||
void NodeEdgeAddCommand::undo_internal()
|
||||
{
|
||||
if (!done_) {
|
||||
return;
|
||||
@@ -38,7 +38,7 @@ void NodeEdgeAddCommand::undo()
|
||||
}
|
||||
|
||||
NodeEdgeRemoveCommand::NodeEdgeRemoveCommand(NodeOutput *output, NodeInput *input, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
output_(output),
|
||||
input_(input),
|
||||
done_(false)
|
||||
@@ -46,14 +46,14 @@ NodeEdgeRemoveCommand::NodeEdgeRemoveCommand(NodeOutput *output, NodeInput *inpu
|
||||
}
|
||||
|
||||
NodeEdgeRemoveCommand::NodeEdgeRemoveCommand(NodeEdgePtr edge, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
output_(edge->output()),
|
||||
input_(edge->input()),
|
||||
done_(false)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeEdgeRemoveCommand::redo()
|
||||
void NodeEdgeRemoveCommand::redo_internal()
|
||||
{
|
||||
if (done_) {
|
||||
return;
|
||||
@@ -63,7 +63,7 @@ void NodeEdgeRemoveCommand::redo()
|
||||
done_ = true;
|
||||
}
|
||||
|
||||
void NodeEdgeRemoveCommand::undo()
|
||||
void NodeEdgeRemoveCommand::undo_internal()
|
||||
{
|
||||
if (!done_) {
|
||||
return;
|
||||
@@ -74,7 +74,7 @@ void NodeEdgeRemoveCommand::undo()
|
||||
}
|
||||
|
||||
NodeAddCommand::NodeAddCommand(NodeGraph *graph, Node *node, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
graph_(graph),
|
||||
node_(node)
|
||||
{
|
||||
@@ -82,24 +82,24 @@ NodeAddCommand::NodeAddCommand(NodeGraph *graph, Node *node, QUndoCommand *paren
|
||||
node_->setParent(&memory_manager_);
|
||||
}
|
||||
|
||||
void NodeAddCommand::redo()
|
||||
void NodeAddCommand::redo_internal()
|
||||
{
|
||||
graph_->AddNode(node_);
|
||||
}
|
||||
|
||||
void NodeAddCommand::undo()
|
||||
void NodeAddCommand::undo_internal()
|
||||
{
|
||||
graph_->TakeNode(node_, &memory_manager_);
|
||||
}
|
||||
|
||||
NodeRemoveCommand::NodeRemoveCommand(NodeGraph *graph, const QList<Node *> &nodes, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
graph_(graph),
|
||||
nodes_(nodes)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeRemoveCommand::redo()
|
||||
void NodeRemoveCommand::redo_internal()
|
||||
{
|
||||
// Cache edges for undoing
|
||||
foreach (Node* n, nodes_) {
|
||||
@@ -119,7 +119,7 @@ void NodeRemoveCommand::redo()
|
||||
}
|
||||
}
|
||||
|
||||
void NodeRemoveCommand::undo()
|
||||
void NodeRemoveCommand::undo_internal()
|
||||
{
|
||||
// Re-add nodes to graph
|
||||
foreach (Node* n, nodes_) {
|
||||
@@ -135,7 +135,7 @@ void NodeRemoveCommand::undo()
|
||||
}
|
||||
|
||||
NodeRemoveWithExclusiveDeps::NodeRemoveWithExclusiveDeps(NodeGraph *graph, Node *node, QUndoCommand *parent) :
|
||||
QUndoCommand(parent)
|
||||
UndoCommand(parent)
|
||||
{
|
||||
QList<Node*> node_and_its_deps;
|
||||
node_and_its_deps.append(node);
|
||||
@@ -145,7 +145,7 @@ NodeRemoveWithExclusiveDeps::NodeRemoveWithExclusiveDeps(NodeGraph *graph, Node
|
||||
}
|
||||
|
||||
NodeCopyInputsCommand::NodeCopyInputsCommand(Node *src, Node *dest, bool include_connections, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
src_(src),
|
||||
dest_(dest),
|
||||
include_connections_(include_connections)
|
||||
@@ -153,14 +153,14 @@ NodeCopyInputsCommand::NodeCopyInputsCommand(Node *src, Node *dest, bool include
|
||||
}
|
||||
|
||||
NodeCopyInputsCommand::NodeCopyInputsCommand(Node *src, Node *dest, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
UndoCommand(parent),
|
||||
src_(src),
|
||||
dest_(dest),
|
||||
include_connections_(true)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeCopyInputsCommand::redo()
|
||||
void NodeCopyInputsCommand::redo_internal()
|
||||
{
|
||||
Node::CopyInputs(src_, dest_, include_connections_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user