private void RemoveSelectedTextures() { var result = MessageBox.Show("Are you sure you want to remove these textures?", "Layout Edtior", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { foreach (ListViewItem item in listViewCustom1.SelectedItems) { var texture = item.Text; if (TextureList.ContainsKey(texture)) { ActiveLayout.TextureManager.RemoveTexture(TextureList[texture]); foreach (var bntx in PluginRuntime.bntxContainers) { if (bntx.Textures.ContainsKey(texture)) { bntx.Textures.Remove(texture); } } if (PluginRuntime.bflimTextures.ContainsKey(texture)) { PluginRuntime.bflimTextures.Remove(texture); } TextureList.Remove(texture); } ActiveLayout.RemoveTexture(texture); listViewCustom1.Items.Remove(item); ParentEditor.UpdateViewport(); } } }
private void loadFontFile(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = Utils.GetAllFilters(new Type[] { typeof(FirstPlugin.BXFNT), }); if (ofd.ShowDialog() == DialogResult.OK) { var fileFormat = Toolbox.Library.IO.STFileLoader.OpenFileFormat(ofd.FileName); if (fileFormat is IArchiveFile) { foreach (var file in ((IArchiveFile)fileFormat).Files) { var archiveFile = file.OpenFile(); if (archiveFile is FirstPlugin.BXFNT) { } } } ParentEditor.UpdateViewport(); } }
private void treeView1_DragDrop(object sender, DragEventArgs e) { /* if (e.Data.GetDataPresent(typeof(PaneTreeWrapper))) * { * Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y)); * TreeNode NodeOver = treeView1.GetNodeAt(targetPoint); * TreeNode NodeMoving = (PaneTreeWrapper)e.Data.GetData(typeof(PaneTreeWrapper)); * * if (NodeOver != null && (NodeOver != NodeMoving || (NodeOver.Parent != null && NodeOver.Index == (NodeOver.Parent.Nodes.Count - 1)))) * { * int OffsetY = this.treeView1.PointToClient(Cursor.Position).Y - NodeOver.Bounds.Top; * int NodeOverImageWidth = this.treeView1.ImageList.Images[NodeOver.ImageIndex].Size.Width + 8; * Graphics g = this.treeView1.CreateGraphics(); * * //Folder node * * if (OffsetY < (NodeOver.Bounds.Height / 3)) * { * TreeNode tnParadox = NodeOver; * while (tnParadox.Parent != null) * { * if (tnParadox.Parent == NodeMoving) * { * this.NodeMap = ""; * return; * } * * tnParadox = tnParadox.Parent; * } * } * } * }*/ #endregion if (e.Data.GetDataPresent(typeof(PaneTreeWrapper))) { Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y)); TreeNode targetNode = treeView1.GetNodeAt(targetPoint); TreeNode draggedNode = (PaneTreeWrapper)e.Data.GetData(typeof(PaneTreeWrapper)); var draggedPane = draggedNode.Tag as BasePane; if (draggedPane == null || draggedPane.IsRoot) { return; } TreeNode parentNode = targetNode; if (targetNode != null && targetNode.Parent != null) { bool canDrop = true; while (canDrop && (parentNode != null)) { canDrop = !Object.ReferenceEquals(draggedNode, parentNode); parentNode = parentNode.Parent; } if (!canDrop) { return; } bool isTargetParent = targetNode.Equals(draggedNode.Parent); //Remove it's previous parent draggedPane.Parent.Childern.Remove(draggedPane); draggedNode.Remove(); //Adjust the parent to the parent's parent Console.WriteLine("isTargetParent " + isTargetParent); if (isTargetParent) { var parentPane = targetNode.Tag as BasePane; if (parentPane.IsRoot) { return; } var upperParentNode = targetNode.Parent; var upperParentPane = upperParentNode.Tag as BasePane; draggedPane.ResetParentTransform(upperParentPane); draggedPane.Parent = upperParentPane; upperParentPane.Childern.Add(draggedPane); upperParentNode.Nodes.Add(draggedNode); upperParentNode.Expand(); } else //Set the target node as the parent { var parentPane = targetNode.Tag as BasePane; draggedPane.ResetParentTransform(parentPane); draggedPane.Parent = parentPane; parentPane.Childern.Add(draggedPane); targetNode.Nodes.Add(draggedNode); targetNode.Expand(); } ParentEditor.UpdateViewport(); } } }