Exemple #1
0
        public static DragDropHandler GetDragDropHandlerForNode(Outliner.TreeView tree, OutlinerNode node)
        {
            if (node is OutlinerObject)
            {
                OutlinerObject obj = (OutlinerObject)node;
                if (obj.IsGroupHead || obj.IsGroupMember) return new GroupDragDropHandler(tree, obj);
                if (obj.Class == OutlinerScene.ContainerType) return new ContainerDragDropHandler(tree, obj);
                if (obj.SuperClass == OutlinerScene.SpacewarpType) return new SpaceWarpDragDropHandler(tree, obj);

                return new ObjectDragDropHandler(tree, obj);
            }
            else if (node is OutlinerMaterial)
                return new MaterialDragDropHandler(tree, (OutlinerMaterial)node);
            else if (node is OutlinerLayer)
                return new LayerDragDropHandler(tree, (OutlinerLayer)node);

            return new DragDropHandler(tree, node);
        }
Exemple #2
0
      private TreeNode CreateTreeNodeForOutlinerNode(OutlinerNode n)
      {
         TreeNode tn = new TreeNode(n.DisplayName);

         n.DragDropHandler = DragDropHandler.GetDragDropHandlerForNode(this, n);
         tn.Tag = n;

         Style.SetNodeColor(tn, NodeColor.Default);

         return tn;
      }
Exemple #3
0
 private void getChildHandles_intern(OutlinerNode n, OutlinerNode[] nodes, ref List<Int32> handles)
 {
     foreach (OutlinerNode cn in n.ChildNodes)
     {
         if (cn is OutlinerObject && !arrayContains(nodes, cn))
             handles.Add(((OutlinerObject)cn).Handle);
         getChildHandles_intern(cn, nodes, ref handles);
     }
 }
Exemple #4
0
 private Color GetNodeForeColor(OutlinerNode node)
 {
     if (node is IDisplayable && ((IDisplayable)node).IsHidden)
         return HiddenForeColor;
     else if (node is IDisplayable && ((IDisplayable)node).IsFrozen)
         return FrozenForeColor;
     else if (node is OutlinerObject && ((OutlinerObject)node).Class == OutlinerScene.XrefObjectType)
         return XrefForeColor;
     else
         return NodeForeColor;
 }
Exemple #5
0
 protected virtual Boolean IsDroppableNode(OutlinerNode o)
 {
     return false;
 }
Exemple #6
0
 internal List<Int32> getChildNodeHandlesRecursive(OutlinerNode node)
 {
    List<Int32> childHandles = new List<Int32>();
    foreach (OutlinerNode cn in node.ChildNodes)
    {
       childHandles.Add(cn.Handle);
       childHandles.AddRange(getChildNodeHandlesRecursive(cn));
    }
    return childHandles;
 }
 protected override bool IsDroppableNode(OutlinerNode o)
 {
     if (Tree.ListMode == OutlinerListMode.Hierarchy || Tree.ListMode == OutlinerListMode.Material)
         return (o is OutlinerObject);
     else if (Tree.ListMode == OutlinerListMode.Layer)
         return (o is OutlinerLayer);
     else
         return false;
 }
Exemple #8
0
      internal void FreezeNode(OutlinerNode n, Boolean frozen)
      {
         if (n is IDisplayable && ((IDisplayable)n).IsFrozen != frozen)
         {
            ((IDisplayable)n).IsFrozen = frozen;

            ApplyFilter(n, ListMode == OutlinerListMode.Hierarchy,
                           ListMode == OutlinerListMode.Layer,
                           ListMode == OutlinerListMode.Material);
         }
      }
Exemple #9
0
      internal void FreezeNodeRecursive(OutlinerNode n, Boolean frozen)
      {
         FreezeNode(n, frozen);

         foreach (OutlinerNode cn in n.ChildNodes)
            FreezeNodeRecursive(cn, frozen);
      }
Exemple #10
0
      internal void HideNode(OutlinerNode n, Boolean hidden)
      {
         if (n is IDisplayable && ((IDisplayable)n).IsHidden != hidden)
         {
            ((IDisplayable)n).IsHidden = hidden;

            ApplyFilter(n, ListMode == OutlinerListMode.Hierarchy, 
                           ListMode == OutlinerListMode.Layer, 
                           ListMode == OutlinerListMode.Material);

            if (_treeViewNodeSorter is Outliner.NodeSorters.VisibilitySorter)
               BeginTimedSort();
         }
      }
Exemple #11
0
 internal void HideNodeRecursive(OutlinerNode n, Boolean hidden)
 {
    HideNode(n, hidden);
    foreach (OutlinerNode cn in n.ChildNodes)
    {
       HideNodeRecursive(cn, hidden);
    }
 }
Exemple #12
0
      private void RecursiveRemoveTreeNodeIntern(OutlinerNode n, TreeNode tn, Boolean removeReferences)
      {
    //     n.MarkedForDelete = true;

         if (removeReferences)
         {
            this._expandedNodeHandles.Remove(n.Handle);
            _selectedNodes.Remove(n);
         }
         RemoveParentHighlights(n);
         _treeNodes.Remove(n);

         foreach (TreeNode cn in tn.Nodes)
            RecursiveRemoveTreeNodeIntern((OutlinerNode)cn.Tag, cn, removeReferences);
      }
Exemple #13
0
 private void RecursiveRemoveTreeNode(OutlinerNode n, TreeNode tn, Boolean removeReferences)
 {
    RecursiveRemoveTreeNodeIntern(n, tn, removeReferences);
    tn.Remove();
 }
Exemple #14
0
      internal void RemoveNodeFromTree(OutlinerNode n, Boolean removeReferences)
      {
         if (n == null)
            return;

    //     n.MarkedForDelete = true;

         if (ListMode == OutlinerListMode.Hierarchy)
            n = GetHighestParentToRemove(n);

         TreeNode tn;
         if (_treeNodes.TryGetValue(n, out tn))
            RecursiveRemoveTreeNode(n, tn, removeReferences);
      }
Exemple #15
0
 private OutlinerNode GetHighestParentToAdd(OutlinerNode o)
 {
    if (ListMode == OutlinerListMode.Layer)
       return o;
    else
    {
       // Keeping prevParentNode reference (previous parentNode inspected) to avoid having to do dictionary lookup twice for each iteration.
       OutlinerNode parentNode = o;
       OutlinerNode prevParentNode = o;
       while (parentNode != null && !_treeNodes.ContainsKey(parentNode))
       {
          prevParentNode = parentNode;
          parentNode = parentNode.Parent;
       }
       return prevParentNode;
    }
 }
Exemple #16
0
      internal void ApplyFilter(OutlinerNode n, Boolean recurseObjects, Boolean recurseLayers, Boolean recurseMaterials)
      {
         Boolean showNode = this.Filter.ShowNode(n);
         TreeNode tn;
         _treeNodes.TryGetValue(n, out tn);

         if (tn != null)
         {
            if (showNode)
            {
               Style.SetNodeColorAuto(tn);
               InvalidateTreeNode(tn);
            }
            else
               RemoveNodeFromTree(n, true);
         }
         else
         {
            if (showNode)
            {
               if (n is OutlinerObject && (ListMode != OutlinerListMode.Layer || !HideGroupMembersLayerMode || !((OutlinerObject)n).IsGroupMember))
                  AddObjectToTree((OutlinerObject)n);
               else if (n is OutlinerLayer && ListMode == OutlinerListMode.Layer)
                  AddLayerToTree((OutlinerLayer)n);
            }
         }

         if ((recurseObjects && n is OutlinerObject) || (recurseLayers && n is OutlinerLayer) || (recurseMaterials && n is OutlinerMaterial))
         {
            foreach (OutlinerNode c in n.ChildNodes)
               ApplyFilter(c, recurseObjects, recurseLayers, recurseMaterials);
         }
      }
Exemple #17
0
 private OutlinerNode GetHighestParentToRemove(OutlinerNode o)
 {
    if (ListMode == OutlinerListMode.Layer)
       return o;
    else
    {
       // Keeping prevParentNode reference (previous parentNode inspected) to avoid having to do dictionary lookup twice for each iteration.
       OutlinerNode parentNode = o.Parent;
       OutlinerNode prevParentNode = o;
       while (parentNode != null && !this.Filter.ShowNode(parentNode))
       {
          prevParentNode = parentNode;
          parentNode = parentNode.Parent;
       }
       return prevParentNode;
    }
 }
Exemple #18
0
 internal void SetBoxModeNode(OutlinerNode n, Boolean boxMode)
 {
    if (n is IDisplayable)
    {
       ((IDisplayable)n).BoxMode = boxMode;
       TreeNode tn;
       if (_treeNodes.TryGetValue(n, out tn))
          InvalidateTreeNode(tn);
    }
 }
 protected override Boolean IsDroppableNode(OutlinerNode o)
 {
     return (o is OutlinerObject);
 }
Exemple #20
0
      internal void SetBoxModeNodeRecursive(OutlinerNode n, Boolean boxMode)
      {
         SetBoxModeNode(n, boxMode);

         foreach (OutlinerNode cn in n.ChildNodes)
            SetBoxModeNodeRecursive(cn, boxMode);
      }
Exemple #21
0
        private String GetImageKey(OutlinerNode node)
        {
            String imgKey = "unknown";

            if (node is OutlinerObject)
                imgKey = GetObjectImageKey((OutlinerObject)node);
            else if (node is OutlinerLayer)
                imgKey = GetLayerImageKey((OutlinerLayer)node);
            else if (node is OutlinerMaterial)
                imgKey = GetMaterialImageKey((OutlinerMaterial)node);

            return imgKey;
        }
Exemple #22
0
      private void RestoreSelection(OutlinerNode[] selection)
      {
         _selectedNodes.Clear();

         foreach (OutlinerNode n in selection)
         {
            SelectNode(n, true);
         }

         BeginTimedEnsureSelectionVisible(EnsureSelectionVisibleAction.SelectionChanged);
         _selectionChanged = false;
      }
 protected override bool IsDroppableNode(OutlinerNode o)
 {
     return (o is OutlinerObject || o is OutlinerLayer);
 }
Exemple #24
0
 private void addChildLayerHandlesRecursive(OutlinerNode layer, ref List<Int32> handles)
 {
    foreach (OutlinerNode n in layer.ChildNodes)
    {
       if (n is OutlinerLayer)
       {
          handles.Add(n.Handle);
          addChildLayerHandlesRecursive(n, ref handles);
       }
    }
 }
Exemple #25
0
 private Boolean arrayContains(OutlinerNode[] nodes, OutlinerNode n)
 {
     EqualityComparer<OutlinerNode> comparer = EqualityComparer<OutlinerNode>.Default;
     for (int i = 0; i < nodes.Length; i++)
     {
         if (comparer.Equals(nodes[i], n))
         {
             return true;
         }
     }
     return false;
 }
Exemple #26
0
      internal Boolean IsNodeSelected(OutlinerNode n)
      {
         if (n == null)
            return false;

         return _selectedNodes.Contains(n);
      }
Exemple #27
0
 public DragDropHandler(Outliner.TreeView tree, OutlinerNode data)
 {
     Tree = tree;
     Data = data;
 }
Exemple #28
0
      internal Boolean IsChildOfSelectedNode(OutlinerNode n)
      {
         if (n == null)
            return false;

         TreeNode tn;
         if (_treeNodes.TryGetValue(n, out tn))
            return IsChildOfSelectedNode(tn);
         else
            return false;
      }
Exemple #29
0
 protected Int32[] getChildHandles(OutlinerNode[] nodes)
 {
     List<Int32> handles = new List<Int32>();
     foreach (OutlinerNode n in nodes)
     {
         getChildHandles_intern(n, nodes, ref handles);
     }
     return handles.ToArray();
 }
Exemple #30
0
      internal void RemoveParentHighlights(OutlinerNode n)
      {
         if ((ListMode != OutlinerListMode.Hierarchy && ListMode != OutlinerListMode.Layer) || n == null)
            return;

         TreeNode tn;
         if (_treeNodes.TryGetValue(n, out tn))
         {
            tn = tn.Parent;
            while (tn != null && !IsNodeSelected(tn) && !IsParentOfSelectedNode(tn, true))
            {
               Style.SetNodeColor(tn, NodeColor.Default);
               tn = tn.Parent;
            }
         }
      }