name every undo command
This commit is contained in:
@@ -141,11 +141,13 @@ void NodeView::DeleteSelected()
|
||||
{
|
||||
NodeViewDeleteCommand* command = new NodeViewDeleteCommand();
|
||||
|
||||
int count = 0;
|
||||
|
||||
foreach (NodeViewContext *ctx, scene_.context_map()) {
|
||||
ctx->DeleteSelected(command);
|
||||
count += ctx->DeleteSelected(command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Deleted %1 Node(s)").arg(count));
|
||||
}
|
||||
|
||||
void NodeView::SelectAll()
|
||||
@@ -356,7 +358,7 @@ void NodeView::SetColorLabel(int index)
|
||||
command->add_child(new NodeOverrideColorCommand(node, index));
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Set Color of %1 Node(s)").arg(selected_nodes_.size()));
|
||||
}
|
||||
|
||||
void NodeView::ZoomIn()
|
||||
@@ -411,7 +413,7 @@ void NodeView::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
Core::instance()->undo_stack()->push(pos_command);
|
||||
Core::instance()->undo_stack()->push(pos_command, tr("Moved %1 Node(s)").arg(selected_nodes_.size()));
|
||||
break;
|
||||
}
|
||||
case Qt::Key_Escape:
|
||||
@@ -579,9 +581,10 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event)
|
||||
command->add_child(new NodeSetPositionCommand(i->GetNode(), i->GetContext(), current_pos));
|
||||
}
|
||||
}
|
||||
dragging_items_.clear();
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Moved %1 Node(s)").arg(dragging_items_.size()));
|
||||
|
||||
dragging_items_.clear();
|
||||
|
||||
if (!had_attached_items) {
|
||||
super::mouseReleaseEvent(event);
|
||||
@@ -674,7 +677,7 @@ void NodeView::dropEvent(QDropEvent *event)
|
||||
if (Node *drop_ctx = GetContextAtMousePos(event->pos())) {
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
QVector<Node*> select_nodes = ProcessDroppingAttachedNodes(command, drop_ctx, event->pos());
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Dropped %1 Node(s)").arg(select_nodes.size()));
|
||||
|
||||
DeselectAll();
|
||||
scene_.context_map().value(drop_ctx)->Select(select_nodes);
|
||||
@@ -1431,7 +1434,7 @@ void NodeView::GroupNodes()
|
||||
// Do command
|
||||
Core::instance()->LabelNodes({group}, command);
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Grouped Nodes"));
|
||||
}
|
||||
|
||||
void NodeView::UngroupNodes()
|
||||
@@ -1466,7 +1469,7 @@ void NodeView::UngroupNodes()
|
||||
command->add_child(new NodeSetPositionCommand(it.key(), context, group->GetNodePositionDataInContext(it.key())));
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, tr("Ungrouped Nodes"));
|
||||
}
|
||||
|
||||
void NodeView::ShowNodeProperties()
|
||||
@@ -1622,6 +1625,8 @@ void NodeView::EndEdgeDrag(bool cancel)
|
||||
create_edge_input_item_->SetHighlighted(false);
|
||||
}
|
||||
|
||||
QString command_name;
|
||||
|
||||
NodeInput &creating_input = create_edge_input_;
|
||||
if (create_edge_output_item_ && create_edge_input_item_ && !cancel) {
|
||||
if (creating_input.IsValid()) {
|
||||
@@ -1658,6 +1663,8 @@ void NodeView::EndEdgeDrag(bool cancel)
|
||||
if (!cancel) {
|
||||
command->add_child(new NodeEdgeAddCommand(creating_output, creating_input));
|
||||
|
||||
command_name = Node::GetConnectCommandString(creating_output, creating_input);
|
||||
|
||||
// If the output is not in the input's context, add it now. We check the item rather than
|
||||
// the node itself, because sometimes a node may not be in the context but another node
|
||||
// representing it will be (e.g. groups)
|
||||
@@ -1680,7 +1687,7 @@ void NodeView::EndEdgeDrag(bool cancel)
|
||||
}
|
||||
create_edge_expanded_items_.clear();
|
||||
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
Core::instance()->undo_stack()->push(command, command_name);
|
||||
}
|
||||
|
||||
void NodeView::PostPaste(const QVector<Node *> &new_nodes, const Node::PositionMap &map)
|
||||
|
||||
@@ -191,8 +191,10 @@ void NodeViewContext::SetCurvedEdges(bool e)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command)
|
||||
int NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
// Delete any selected edges
|
||||
foreach (NodeViewEdge *edge, edges_) {
|
||||
if (edge->isSelected()) {
|
||||
@@ -204,8 +206,11 @@ void NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command)
|
||||
foreach (NodeViewItem *node, item_map_) {
|
||||
if (node->isSelected()) {
|
||||
command->AddNode(node->GetNode(), context_);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void NodeViewContext::Select(const QVector<Node *> &nodes)
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
void SetCurvedEdges(bool e);
|
||||
|
||||
void DeleteSelected(NodeViewDeleteCommand *command);
|
||||
int DeleteSelected(NodeViewDeleteCommand *command);
|
||||
|
||||
void Select(const QVector<Node*> &nodes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user