From 933785f19fcabf40cd4f7ef014c238b10829f940 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 2 Sep 2012 00:43:54 -0400 Subject: [PATCH] Fixed UI and modify status not updating for some operations --- MainForm.cs | 20 +++++++++----------- Model/TagCompoundDataNode.cs | 1 + Model/TagDataNode.cs | 1 + Model/TagListDataNode.cs | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index b7a98cf..228929a 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -128,6 +128,8 @@ namespace NBTExplorer if (ofd.ShowDialog() == DialogResult.OK) { OpenPaths(ofd.FileNames); } + + UpdateUI(); } private void OpenFolder () @@ -140,6 +142,8 @@ namespace NBTExplorer _openFolderPath = ofd.SelectedPath; OpenPaths(new string[] { ofd.SelectedPath }); } + + UpdateUI(); } public void OpenPaths (string[] paths) @@ -160,6 +164,8 @@ namespace NBTExplorer if (_nodeTree.Nodes.Count > 0) { _nodeTree.Nodes[0].Expand(); } + + UpdateUI(); } private void OpenMinecraftDirectory () @@ -185,6 +191,8 @@ namespace NBTExplorer Application.Exit(); } } + + UpdateUI(); } private TreeNode CreateUnexpandedNode (DataNode node) @@ -310,17 +318,6 @@ namespace NBTExplorer foreach (TreeNode child in node.Nodes) child.ContextMenuStrip = BuildNodeContextMenu(child.Tag as DataNode); - /*foreach (DataNode child in dataNode.Nodes) { - if (!currentNodes.ContainsKey(child)) - node.Nodes.Add(CreateUnexpandedNode(child)); - else - currentNodes.Remove(child); - } - - foreach (TreeNode child in currentNodes.Values) { - node.Nodes.Remove(child); - }*/ - if (node.Nodes.Count == 0 && dataNode.HasUnexpandedChildren) { ExpandNode(node); node.Expand(); @@ -353,6 +350,7 @@ namespace NBTExplorer if (dataNode.RenameNode()) { node.Text = dataNode.NodeDisplay; + UpdateUI(dataNode); } } diff --git a/Model/TagCompoundDataNode.cs b/Model/TagCompoundDataNode.cs index 569a9e1..d4810ae 100644 --- a/Model/TagCompoundDataNode.cs +++ b/Model/TagCompoundDataNode.cs @@ -100,6 +100,7 @@ namespace NBTExplorer.Model private void AddTag (TagNode tag, string name) { _container.AddTag(tag, name); + IsModified = true; if (IsExpanded) { TagDataNode node = TagDataNode.CreateFromTag(tag); diff --git a/Model/TagDataNode.cs b/Model/TagDataNode.cs index b084621..9ddc61f 100644 --- a/Model/TagDataNode.cs +++ b/Model/TagDataNode.cs @@ -275,6 +275,7 @@ namespace NBTExplorer.Model DataNode parent = Parent; parent.Nodes.Remove(this); parent.Nodes.Insert(newIndex, this); + parent.IsModified = true; return true; } diff --git a/Model/TagListDataNode.cs b/Model/TagListDataNode.cs index 42ad81f..d1d456b 100644 --- a/Model/TagListDataNode.cs +++ b/Model/TagListDataNode.cs @@ -100,6 +100,7 @@ namespace NBTExplorer.Model private void AppendTag (TagNode tag) { _container.InsertTag(tag, _container.TagCount); + IsModified = true; if (IsExpanded) { TagDataNode node = TagDataNode.CreateFromTag(tag);