private SceneNode InsertNode(SceneNode node) { SmartInsertionPoint smartInsertionPoint = SmartInsertionPoint.From(this.InsertionPoint); if (smartInsertionPoint == null) { return((SceneNode)null); } smartInsertionPoint.Insert(node); return(node); }
protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor) { if (!this.SourceData.CanCreateInstance(this.InsertionPoint)) { return(false); } descriptor.DisableCopy(); descriptor.SetCreateIn(this.InsertionPoint); descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection); return(descriptor.CanDrop); }
private SceneNode InsertBehavior(BehaviorNode behaviorNode) { SmartInsertionPoint smartInsertionPoint = SmartInsertionPoint.From(this.InsertionPoint); if (smartInsertionPoint == null) { return((SceneNode)null); } smartInsertionPoint.Insert((SceneNode)behaviorNode); return((SceneNode)behaviorNode); }
protected ISceneInsertionPoint GetInsertionPoint(object data, DragDropContext context) { this.CheckNullArgument(data, "data"); if (context.Target != null) { ISceneInsertionPoint insertionPoint = context.Target.GetInsertionPoint(data, context); if (insertionPoint != null) { return((ISceneInsertionPoint)SmartInsertionPoint.From(insertionPoint, context.Descriptor.DropIndex)); } } return((ISceneInsertionPoint)null); }
protected override DragDropEffects OnHandleDrop(DragDropEffects dropEffects) { if (!this.TryValidateDropAction()) { return(DragDropEffects.None); } int index = SmartInsertionPoint.From(this.InsertionPoint).Index; if ((dropEffects & DragDropEffects.Copy) != DragDropEffects.None) { this.Copy(index); } else if ((dropEffects & DragDropEffects.Move) != DragDropEffects.None) { this.Move(index); } return(DragDropEffects.None); }
protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor) { descriptor.DisableInBetween(); if (!this.InsertionPoint.CanInsert((ITypeId)this.SourceData.Type)) { return(false); } if (descriptor.AllowCopy) { descriptor.SetCopyInto(this.InsertionPoint); } else { descriptor.SetMoveInto(this.InsertionPoint); } descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection); return(true); }
private SceneNode Copy(SceneNode node, ref int index) { SceneElement sceneElement1 = node as SceneElement; DocumentNode node1 = sceneElement1.DocumentNode.Clone(sceneElement1.DocumentContext); SceneElement sceneElement2 = (SceneElement)null; bool flag = false; if (node1 != null) { sceneElement2 = this.ViewModel.GetSceneNode(node1) as SceneElement; if (sceneElement2 != null) { if (sceneElement1.ParentElement != this.TargetNode) { DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)sceneElement2.DocumentNode; documentCompositeNode.ClearValue(DesignTimeProperties.ClassProperty); documentCompositeNode.ClearValue(DesignTimeProperties.SubclassProperty); documentCompositeNode.ClearValue(DesignTimeProperties.ClassModifierProperty); flag = true; } SmartInsertionPoint.From(this.InsertionPoint, index).Insert((SceneNode)sceneElement2); if (flag) { BaseFrameworkElement element = sceneElement2 as BaseFrameworkElement; ILayoutDesigner layoutDesigner = element == null ? (ILayoutDesigner)null : this.ViewModel.GetLayoutDesignerForChild((SceneElement)element, true); if (layoutDesigner != null) { this.ViewModel.Document.OnUpdatedEditTransaction(); LayoutCacheRecord layoutCacheRecord; if (element.ViewObject != null && sceneElement1 is BaseFrameworkElement && this.layoutCache.TryGetValue((SceneNode)sceneElement1, out layoutCacheRecord)) { layoutDesigner.SetLayoutFromCache(element, layoutCacheRecord, this.boundsOfAllElements); } } } } } if (index != -1) { ++index; } return((SceneNode)sceneElement2); }
private bool CanDrop(SceneNode node, TimelineDragDescriptor descriptor) { SceneElement sceneElement; if (!descriptor.AllowCopy && !descriptor.AllowMove || ((sceneElement = node as SceneElement) == null || !this.InsertionPoint.CanInsert((ITypeId)sceneElement.Type))) { return(false); } if (descriptor.AllowCopy) { descriptor.SetCopyInto(this.InsertionPoint); } else { if (sceneElement.IsAncestorOf(this.TargetNode)) { return(false); } descriptor.SetMoveInto(this.InsertionPoint); } descriptor.TryReplace((object)sceneElement, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection); return(true); }
protected override bool OnQueryCanDrop(TimelineDragDescriptor descriptor) { descriptor.DisableInBetween(); if (!this.InsertionPoint.CanInsert((ITypeId)this.SourceData.Type)) { return(false); } if (descriptor.AllowCopy) { descriptor.SetCopyInto(this.InsertionPoint); } else { descriptor.SetMoveInto(this.InsertionPoint); } DocumentNodePath valueAsDocumentNode = this.TargetNode.GetLocalValueAsDocumentNode(Base2DElement.EffectProperty); if (valueAsDocumentNode != null && valueAsDocumentNode.Node == this.SourceData.DocumentNode) { return(false); } descriptor.TryReplace((object)this.SourceData, SmartInsertionPoint.From(this.InsertionPoint), this.DestinationCollection); return(true); }
private SceneNode Move(SceneNode node, ref int index) { SceneElement sceneElement = node as SceneElement; ISceneNodeCollection <SceneNode> destinationCollection = this.DestinationCollection; bool flag = destinationCollection.Contains((SceneNode)sceneElement); BaseFrameworkElement element = sceneElement as BaseFrameworkElement; ILayoutDesigner layoutDesigner1 = element == null ? (ILayoutDesigner)null : this.ViewModel.GetLayoutDesignerForChild((SceneElement)element, false); if (sceneElement.IsAttached) { if (flag) { if (destinationCollection.IndexOf((SceneNode)sceneElement) < index) { --index; } layoutDesigner1 = (ILayoutDesigner)null; } this.TargetNode.ViewModel.RemoveElement((SceneNode)sceneElement); this.ViewModel.Document.OnUpdatedEditTransaction(); } SmartInsertionPoint.From(this.InsertionPoint, index).Insert((SceneNode)sceneElement); this.ViewModel.Document.OnUpdatedEditTransaction(); ILayoutDesigner layoutDesigner2 = element == null ? (ILayoutDesigner)null : this.ViewModel.GetLayoutDesignerForChild((SceneElement)element, false); LayoutCacheRecord layoutCacheRecord; if (layoutDesigner1 != null && layoutDesigner2 != null && (element != null && this.layoutCache.TryGetValue((SceneNode)element, out layoutCacheRecord))) { layoutDesigner2.SetLayoutFromCache(element, layoutCacheRecord, this.boundsOfAllElements); } if (index != -1) { ++index; } return((SceneNode)sceneElement); }
public static SmartInsertionPoint From(ISceneInsertionPoint reference) { return(SmartInsertionPoint.From(reference, -1)); }