internal AfterNodeTextEditEventArgs(TreeNode tn, Boolean canceled, String oldText, String newText) { this.TreeNode = tn; this.Canceled = canceled; this.OldText = oldText; this.NewText = newText; }
protected override string GetTooltipText(TreeNode tn) { if (IsEnabled(tn)) return Resources.Tooltip_UnlockTransforms; else return Resources.Tooltip_LockTransforms; }
public static void CreateEmptyLayer(TreeNode contextTn, IEnumerable<IMaxNode> contextNodes) { CreateNewLayerCommand createCmd = new CreateNewLayerCommand(); createCmd.Execute(); MoveCreatedLayer(contextTn, createCmd.CreatedLayer); }
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(); }
private TreeNodeCollection CreateCollection() { Tree = new TreeView(); Root = new TreeNode("root"); Tree.Nodes.Add(Root); return Root.Nodes; }
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; }
public override bool IsEnabled(TreeNode tn) { INodeWrapper node = TreeMode.GetMaxNode(tn) as INodeWrapper; if (node == null) return false; return node.AllTransformsLocked; }
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"); }
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(); }
public void Add_TreeNode_ContainsAddedNode() { TreeNodeCollection nodes = CreateCollection(); TreeNode tn = new TreeNode(); nodes.Add(tn); Assert.IsTrue(nodes.Contains(tn)); }
public void Add_TreeNode_SetsParent() { TreeNodeCollection nodes = CreateCollection(); TreeNode tn = new TreeNode(); nodes.Add(tn); Assert.AreEqual(Root, tn.Parent); }
public void Add_TreeNode_SetsTreeView() { TreeNodeCollection nodes = CreateCollection(); TreeNode child = new TreeNode(); nodes.Add(child); Assert.AreEqual(Tree, child.TreeView); }
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(); }
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(); }
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; }
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(); } }
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); }
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)); }
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(); }
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; }
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; }
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(); } } }
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(); }
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(); }
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"); }
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."); }
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; } }
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(); }
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(); }