private bool HandleTogglePreview(GraphCommand command) { uint bubbleId = (uint)command.GetArgument(0); if (bubbleId == uint.MaxValue) { return(ToggleAllPreviews()); } PreviewBubble previewBubble = bubbleCollection[bubbleId] as PreviewBubble; if (previewBubble == null) { return(false); } VisualNode node = GetVisualNode(previewBubble.OwnerId); if (node == null) { return(false); } List <IVisualNode> nodeList = new List <IVisualNode>(); nodeList.Add(node); undoRedoRecorder.BeginGroup(); undoRedoRecorder.RecordNodeModificationForUndo(nodeList); undoRedoRecorder.EndGroup(); if (node.NodeStates.HasFlag(States.PreviewHidden)) { node.ClearState(States.PreviewHidden); CurrentSynchronizer.BeginQueryNodeValue(node.NodeId); } else { node.SetNodeState(States.PreviewHidden); } previewBubble.Collapse(node.NodeStates.HasFlag(States.PreviewHidden)); return(true); }
private void CreateNodeInternal(VisualNode node, double x, double y) { if (null == node) throw new ArgumentNullException("node"); if (CoreComponent.Instance.StudioSettings.SuppressPreview) node.SetNodeState(States.PreviewHidden); node.X = x; node.Y = y; node.Compose(); // Just to compute the dimension. DeltaNodes deltaNodes = new DeltaNodes(); deltaNodes.AppendToAddedNodes(node); if (node.VisualType != NodeType.CodeBlock) { bool visualOnlyNode = (node.VisualType == NodeType.Condensed || (node.VisualType == NodeType.Render)); this.undoRedoRecorder.BeginGroup(); this.undoRedoRecorder.RecordRuntimeStatesForUndo(this.graphProperties.RuntimeStates); this.undoRedoRecorder.RecordNodeCreationForUndo(deltaNodes.AddedNodes); this.graphProperties.RuntimeStates.AddVariablesDefinedInNode(node, false); if (false == visualOnlyNode) { List<IVisualNode> modifiedNodes = new List<IVisualNode>(); EstablishImplicitConnections(modifiedNodes); deltaNodes.AppendToModifiedNodes(modifiedNodes); } this.undoRedoRecorder.EndGroup(); if (false == visualOnlyNode) this.SynchronizeToLiveRunner(deltaNodes); } this.UpdateDirtyNodes(); node.PositionAtCenter(node.NodeId); }