Ejemplo n.º 1
0
 internal AfterNodeTextEditEventArgs(TreeNode tn, Boolean canceled, String oldText, String newText)
 {
    this.TreeNode = tn;
    this.Canceled = canceled;
    this.OldText = oldText;
    this.NewText = newText;
 }
Ejemplo n.º 2
0
 protected override string GetTooltipText(TreeNode tn)
 {
    if (IsEnabled(tn))
       return Resources.Tooltip_UnlockTransforms;
    else
       return Resources.Tooltip_LockTransforms;
 }
Ejemplo n.º 3
0
   public static void CreateEmptyLayer(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
   {
      CreateNewLayerCommand createCmd = new CreateNewLayerCommand();
      createCmd.Execute();

      MoveCreatedLayer(contextTn, createCmd.CreatedLayer);
   }
Ejemplo n.º 4
0
 protected override string GetText(TreeNode tn)
 {
    INodeWrapper iinode = TreeMode.GetMaxNode(tn) as INodeWrapper;
    if (iinode == null)
       return "0";
    else
       return IINodes.GetPolyCount(iinode.INode).ToString();
 }
Ejemplo n.º 5
0
      private TreeNodeCollection CreateCollection()
      {
         Tree = new TreeView();
         Root = new TreeNode("root");
         Tree.Nodes.Add(Root);

         return Root.Nodes;
      }
Ejemplo n.º 6
0
   internal BeforeNodeTextEditEventArgs(TreeNode tn) : base(false)
   {
      if (tn == null)
         throw new ArgumentNullException("tn");

      this.TreeNode = tn;
      this.EditText = tn.Text;
   }
      protected override string GetTooltipText(TreeNode tn)
      {
         XRefSceneRecord xrefScene = TreeMode.GetMaxNode(tn) as XRefSceneRecord;
         if (xrefScene == null)
            return null;

         return Resources.Tooltip_AutoUpdate;
      }
Ejemplo n.º 8
0
      public override bool IsEnabled(TreeNode tn)
      {
         INodeWrapper node = TreeMode.GetMaxNode(tn) as INodeWrapper;
         if (node == null)
            return false;

         return node.AllTransformsLocked;
      }
Ejemplo n.º 9
0
 public void LevelTest()
 {
    TreeNode tn1 = new TreeNode();
    TreeNode tn2 = new TreeNode();
    Nodes.Add(tn1);
    tn1.Nodes.Add(tn2);
    Assert.AreEqual(0, tn1.Level, "tn1 level");
    Assert.AreEqual(1, tn2.Level, "tn2 level");
 }
Ejemplo n.º 10
0
   public static void SetCurrentLayer(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
   {
      ILayerWrapper layer = TreeMode.GetMaxNode(contextTn) as ILayerWrapper;
      if (layer == null)
         return;

      SetCurrentLayerCommand cmd = new SetCurrentLayerCommand(layer);
      cmd.Execute();
   }
Ejemplo n.º 11
0
      public void Add_TreeNode_ContainsAddedNode()
      {
         TreeNodeCollection nodes = CreateCollection();
         TreeNode tn = new TreeNode();

         nodes.Add(tn);

         Assert.IsTrue(nodes.Contains(tn));
      }
Ejemplo n.º 12
0
      public void Add_TreeNode_SetsParent()
      {
         TreeNodeCollection nodes = CreateCollection();

         TreeNode tn = new TreeNode();
         nodes.Add(tn);

         Assert.AreEqual(Root, tn.Parent);
      }
Ejemplo n.º 13
0
      public void Add_TreeNode_SetsTreeView()
      {
         TreeNodeCollection nodes = CreateCollection();
         
         TreeNode child = new TreeNode();
         nodes.Add(child);

         Assert.AreEqual(Tree, child.TreeView);
      }
Ejemplo n.º 14
0
   public static void SelectChildNodes(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
   {
      Throw.IfNull(contextNodes, "contextNodes");

      IEnumerable<IMaxNode> nodes = GetChildNodes(contextNodes);

      SelectCommand cmd = new SelectCommand(nodes);
      cmd.Execute();
      Viewports.Redraw();
   }
Ejemplo n.º 15
0
      public static void SetActiveViewCamera(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
      {
         IMaxNode clickedNode = TreeMode.GetMaxNode(contextTn);
         if (clickedNode == null)
            return;

         SetViewCameraCommand cmd = new SetViewCameraCommand(clickedNode, Viewports.ActiveView);
         cmd.Execute();
         Viewports.Redraw();
      }
Ejemplo n.º 16
0
      protected override string GetTooltipText(TreeNode tn)
      {
         IXRefRecord xrefRecord = TreeMode.GetMaxNode(tn) as IXRefRecord;
         if (xrefRecord == null)
            return null;

         if (xrefRecord.Enabled)
            return Resources.Tooltip_Disable;
         else
            return Resources.Tooltip_Enable;
      }
Ejemplo n.º 17
0
   public static void Delete(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
   {
      Throw.IfNull(contextNodes, "contextNodes");

      if (contextTn != null)
      {
         DeleteCommand cmd = new DeleteCommand(contextNodes);
         cmd.Execute();
         Viewports.Redraw();
      }
   }
Ejemplo n.º 18
0
   private static IMaxNode GetSelectedLayer(TreeNode contextTn)
   {
      if (contextTn == null)
         return null;

      IMaxNode node = TreeMode.GetMaxNode(contextTn);
      if (node is ILayerWrapper)
         return node;
      else
         return GetSelectedLayer(contextTn.Parent);
   }
Ejemplo n.º 19
0
      public void Add_FromOtherCollection_RemovesFromOldCollection()
      {
         TreeNode oldParent = new TreeNode();
         TreeNode newParent = new TreeNode();
         TreeNode child = new TreeNode();

         oldParent.Nodes.Add(child);
         newParent.Nodes.Add(child);

         Assert.IsFalse(oldParent.Nodes.Contains(child));
      }
Ejemplo n.º 20
0
      public override void HandleMouseUp(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
      {
         IMaxNode node = TreeMode.GetMaxNode(tn);
         if (node == null)
            return;

         LockTransformsCommand cmd = new LockTransformsCommand(node.ToIEnumerable(), !IsEnabled(tn));
         cmd.Execute();

         //Todo: check system node events?
         tn.Invalidate();
      }
Ejemplo n.º 21
0
   public static Boolean RenameEnabled(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
   {
      Throw.IfNull(contextNodes, "contextNodes");

      if (contextTn != null)
      {
         IMaxNode node = TreeMode.GetMaxNode(contextTn);
         if (node != null)
            return node.CanEditName;
      }

      return false;
   }
Ejemplo n.º 22
0
 public TreeView CreateTree()
 {
    TreeView tree = new TreeView();
    tree.Width = 100;
    tree.Height = 100;
    TreeNode tn1 = new TreeNode("tn1");
    tn1.IsExpanded = true;
    tree.Nodes.Add(tn1);
    tn1.Nodes.Add(new TreeNode("tn2"));
    tn1.Nodes.Add(new TreeNode("tn3"));
    tree.Nodes.Add(new TreeNode("tn4"));
    return tree;
 }
Ejemplo n.º 23
0
 private static void MoveCreatedLayer(TreeNode contextTn, IMaxNode createdLayer)
 {
    if (contextTn != null)
    {
       IMaxNode node = GetSelectedLayer(contextTn);
       if (node != null)
       {
          AddNodesCommand addCmd = new AddNodesCommand( node
                                                      , createdLayer.ToIEnumerable()
                                                      , Resources.Command_AddToLayer);
          addCmd.Execute();
          Viewports.Redraw();
       }
    }
 }
Ejemplo n.º 24
0
      public override void HandleMouseDown(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
      {
         base.HandleMouseDown(e, tn);

         XRefSceneRecord xrefScene = TreeMode.GetMaxNode(tn) as XRefSceneRecord;
         if (xrefScene == null)
            return;

         Boolean newValue = !xrefScene.HasFlags(this.Flags);

         IEnumerable<IMaxNode> nodes = TreeMode.GetMaxNodes(this.GetContextNodes(tn));

         SetXRefSceneFlagsCommand cmd = new SetXRefSceneFlagsCommand(nodes, this.Flags, newValue);
         cmd.Execute();
         Viewports.Redraw();
      }
Ejemplo n.º 25
0
      public Form2()
      {
         InitializeComponent();

         this.treeView1.BeginUpdate();

         tnA = new TreeNode("testA");
         //tnA.ShowNode = false;
         this.treeView1.Nodes.Add(tnA);

         tnB = new TreeNode("childA");
         //this.tnB.ShowNode = false;
         tnA.Nodes.Add(tnB);
         
         tnC = new TreeNode("childB");
         tnB.Nodes.Add(tnC);

         this.treeView1.EndUpdate();
      }
Ejemplo n.º 26
0
   public void SetParentTest()
   {
      TreeNode tn = new TreeNode();
      TreeNode tn1 = new TreeNode();
      Nodes.Add(tn1);
      TreeNode tn2 = new TreeNode();
      Nodes.Add(tn2);

      tn1.Nodes.Add(tn);
      Assert.AreEqual(tn1, tn.Parent, "Initial parent");
      tn.Parent = tn2;
      Assert.AreEqual(tn2, tn.Parent, "New parent");
      Assert.IsFalse(tn1.Nodes.Contains(tn), "Initial parent nodes should no longer contain tn");
      Assert.IsTrue(tn2.Nodes.Contains(tn), "New parent nodes contains tn");

      tn.Parent = null;
      Assert.IsNull(tn.Parent);
      Assert.IsFalse(tn2.Nodes.Contains(tn), "New parent nodes should no longer contain tn");
   }
Ejemplo n.º 27
0
   public void IsVisibleTest()
   {
      TreeNode root = new TreeNode();
      Nodes.Add(root);
      Assert.IsTrue(root.IsVisible, "Root visibility");

      TreeNode tn1 = new TreeNode();
      root.Nodes.Add(tn1);
      root.IsExpanded = false;
      Assert.IsFalse(tn1.IsVisible, "Childnode of collapsed parent");
      root.IsExpanded = true;
      Assert.IsTrue(tn1.IsVisible, "Childnode of expanded parent.");
      
      TreeNode tn2 = new TreeNode();
      tn1.Nodes.Add(tn2);
      tn1.IsExpanded = true;
      Assert.IsTrue(tn2.IsVisible, "Childnode of expanded parent chain.");
      root.IsExpanded = false;
      Assert.IsFalse(tn2.IsVisible, "Childnode of expanded parent, but collapsed root.");
   }
Ejemplo n.º 28
0
      public override void HandleMouseDown(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
      {
         base.HandleMouseDown(e, tn);

         IXRefRecord xrefRecord = TreeMode.GetMaxNode(tn) as IXRefRecord;
         if (xrefRecord == null)
            return;

         Boolean newValue = !xrefRecord.Enabled;

         IEnumerable<IMaxNode> nodes = TreeMode.GetMaxNodes(this.GetContextNodes(tn))
                                               .ToList();

         foreach (IMaxNode maxNode in nodes)
         {
            IXRefRecord record = maxNode as IXRefRecord;
            if (record != null)
               record.Enabled = newValue;
         }
      }
Ejemplo n.º 29
0
      public override void HandleMouseDown(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
      {
         base.HandleMouseDown(e, tn);

         XRefSceneRecord xrefScene = TreeMode.GetMaxNode(tn) as XRefSceneRecord;
         if (xrefScene == null)
            return;

         Boolean newValue = !xrefScene.HasFlags(this.Flags);

         TreeView tree = this.Layout.TreeView;
         IEnumerable<IMaxNode> nodes = null;
         if (tn.IsSelected && !ControlHelpers.ControlPressed)
            nodes = TreeMode.GetMaxNodes(tree.SelectedNodes);
         else
            nodes = xrefScene.ToIEnumerable<IMaxNode>();

         SetXRefSceneFlagsCommand cmd = new SetXRefSceneFlagsCommand(nodes, this.Flags, newValue);
         cmd.Execute();
         Viewports.Redraw();
      }
Ejemplo n.º 30
0
      public static void ToggleLight(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes)
      {
         IMaxNode clickedNode = TreeMode.GetMaxNode(contextTn);
         if (clickedNode == null)
            return;

         IINode inode = clickedNode.BaseObject as IINode;
         if (inode == null)
            return;

         ILightObject light = inode.ObjectRef as ILightObject;
         if (light == null)
            return;

         IEnumerable<IMaxNode> nodes;
         if (contextNodes.Contains(clickedNode))
            nodes = contextNodes;
         else
            nodes = clickedNode.ToIEnumerable();

         ToggleLightCommand cmd = new ToggleLightCommand(contextNodes, !light.UseLight);
         cmd.Execute();
         Viewports.Redraw();
      }