Exemple #1
0
 public override void Execute()
 {
     if (this.SceneViewModel.TextSelectionSet.IsActive)
     {
         this.SceneViewModel.TextSelectionSet.TextEditProxy.EditingElement.Copy();
     }
     else if (!this.SceneViewModel.KeyFrameSelectionSet.IsEmpty)
     {
         CopyCommand.CopyKeyframes(this.SceneViewModel, this.SceneViewModel.KeyFrameSelectionSet.Selection[0].TargetElement as SceneElement, (ICollection <KeyFrameSceneNode>) this.SceneViewModel.KeyFrameSelectionSet.Selection);
     }
     else if (!this.SceneViewModel.ChildPropertySelectionSet.IsEmpty)
     {
         CopyCommand.CopyPropertyNodes(this.SceneViewModel, (IList <SceneNode>) this.SceneViewModel.ChildPropertySelectionSet.Selection);
     }
     else if (!this.SceneViewModel.BehaviorSelectionSet.IsEmpty)
     {
         CopyCommand.CopyBehaviorNodes(this.SceneViewModel, (IList <BehaviorBaseNode>) this.SceneViewModel.BehaviorSelectionSet.Selection);
     }
     else if (!this.SceneViewModel.AnnotationSelectionSet.IsEmpty && this.DesignerContext.AnnotationService != null)
     {
         this.DesignerContext.AnnotationService.CopyToClipboardAsText((IEnumerable <AnnotationSceneNode>) this.SceneViewModel.AnnotationSelectionSet.Selection);
     }
     else
     {
         List <SceneElement> elements = new List <SceneElement>((IEnumerable <SceneElement>) this.SceneViewModel.ElementSelectionSet.Selection);
         elements.Sort((IComparer <SceneElement>) new ZOrderComparer <SceneElement>(this.SceneViewModel.RootNode));
         CopyCommand.CopyElements(this.SceneViewModel, elements);
     }
 }
Exemple #2
0
 private static void CutBehaviorNodes(SceneViewModel viewModel, IList <BehaviorBaseNode> behaviorNodes)
 {
     CopyCommand.CopyBehaviorNodes(viewModel, behaviorNodes);
     foreach (BehaviorBaseNode node in (IEnumerable <BehaviorBaseNode>)behaviorNodes)
     {
         BehaviorHelper.DeleteBehavior(node);
     }
 }
Exemple #3
0
 public static void CutKeyframes(SceneViewModel viewModel, SceneElement targetElement, ICollection <KeyFrameSceneNode> keyframes)
 {
     CopyCommand.CopyKeyframes(viewModel, targetElement, keyframes);
     foreach (KeyFrameSceneNode keyFrameSceneNode in (IEnumerable <KeyFrameSceneNode>)keyframes)
     {
         viewModel.AnimationEditor.DeleteKeyframe(keyFrameSceneNode.TargetElement, keyFrameSceneNode.TargetProperty, keyFrameSceneNode.Time);
     }
 }
Exemple #4
0
 public static bool CanCopySelection(SceneViewModel viewModel)
 {
     if (viewModel.DesignerContext.ActiveView.EventRouter.IsEditingText)
     {
         if (viewModel.TextSelectionSet.IsActive)
         {
             return(viewModel.TextSelectionSet.CanCopy);
         }
         return(false);
     }
     if (viewModel.ElementSelectionSet.IsEmpty && viewModel.KeyFrameSelectionSet.IsEmpty && (viewModel.ChildPropertySelectionSet.IsEmpty && viewModel.BehaviorSelectionSet.IsEmpty) && viewModel.AnnotationSelectionSet.IsEmpty)
     {
         return(false);
     }
     if (viewModel.ChildPropertySelectionSet.Selection.Count == 1)
     {
         return(true);
     }
     if (viewModel.ChildPropertySelectionSet.Selection.Count > 1)
     {
         return(false);
     }
     if (!viewModel.BehaviorSelectionSet.IsEmpty || !viewModel.AnnotationSelectionSet.IsEmpty)
     {
         return(true);
     }
     if (viewModel.KeyFrameSelectionSet.IsEmpty)
     {
         if (!CopyCommand.ElementsHaveSameParent((ICollection <SceneElement>)viewModel.ElementSelectionSet.Selection))
         {
             return(false);
         }
         foreach (SceneElement sceneElement in viewModel.ElementSelectionSet.Selection)
         {
             if (sceneElement is CameraElement)
             {
                 return(false);
             }
         }
     }
     else
     {
         IEnumerator <KeyFrameSceneNode> enumerator = viewModel.KeyFrameSelectionSet.Selection.GetEnumerator();
         enumerator.MoveNext();
         SceneNode targetElement = enumerator.Current.TargetElement;
         while (enumerator.MoveNext())
         {
             if (enumerator.Current.TargetElement != targetElement)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Exemple #5
0
 public static void CutElements(SceneViewModel viewModel, List <SceneElement> elements)
 {
     CopyCommand.CopyElements(viewModel, elements);
     foreach (SceneElement element in elements)
     {
         if (element.Parent != null)
         {
             viewModel.DeleteElementTree(element);
         }
     }
 }
Exemple #6
0
 public static void CutPropertyNodes(SceneViewModel viewModel, IList <SceneNode> nodes)
 {
     CopyCommand.CopyPropertyNodes(viewModel, nodes);
     foreach (SceneNode sceneNode in (IEnumerable <SceneNode>)nodes)
     {
         if (sceneNode != null)
         {
             sceneNode.Remove();
         }
     }
 }
Exemple #7
0
        public static void CopyElements(SceneViewModel viewModel, List <SceneElement> elements)
        {
            if (elements.Count == 0 || !CopyCommand.ElementsHaveSameParent((ICollection <SceneElement>)elements))
            {
                return;
            }
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CopyElements);
            SceneNode    parent       = elements[0].Parent;
            PastePackage pastePackage = new PastePackage(viewModel);

            using (viewModel.ForceBaseValue())
                pastePackage.AddElements(elements, true);
            pastePackage.SendToClipboard();
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CopyElements);
        }