Skip to content

Commit

Permalink
[HaRepacker] Fixed an issue with renaming TreeView nodes (pointing to…
Browse files Browse the repository at this point in the history
… selected node instead of the node right-clicked)
  • Loading branch information
LastBattle committed Jul 14, 2020
1 parent fe48e73 commit 56bac4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 3 additions & 2 deletions HaRepacker/GUI/ContextMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public ContextMenuManager(MainPanel haRepackerMainPanel, UndoRedoManager undoMan
Rename = new ToolStripMenuItem("Rename", Properties.Resources.rename, new EventHandler(
delegate (object sender, EventArgs e)
{
haRepackerMainPanel.PromptRenameSelectedTreeNode();
WzNode currentNode = currNode;

haRepackerMainPanel.PromptRenameWzTreeNode(currentNode);
}));
Remove = new ToolStripMenuItem("Remove", Properties.Resources.delete, new EventHandler(
delegate (object sender, EventArgs e)
Expand Down Expand Up @@ -130,7 +132,6 @@ public ContextMenuManager(MainPanel haRepackerMainPanel, UndoRedoManager undoMan
{
foreach (WzNode node in GetNodes(sender))
{

node.ExpandAll();
}
}));
Expand Down
10 changes: 3 additions & 7 deletions HaRepacker/GUI/Panels/MainPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,13 @@ public void PromptRemoveSelectedTreeNodes()
/// <summary>
/// Rename an individual node
/// </summary>
public void PromptRenameSelectedTreeNode()
public void PromptRenameWzTreeNode(WzNode node)
{
if (DataTree.SelectedNodes.Count != 1)
{
if (node == null)
return;
}

string newName = "";
System.Windows.Forms.TreeNode currentSelectedNode = DataTree.SelectedNodes[0] as System.Windows.Forms.TreeNode;
WzNode wzNode = (WzNode)currentSelectedNode;

WzNode wzNode = node;
if (RenameInputBox.Show(Properties.Resources.MainConfirmRename, wzNode.Text, out newName))
{
wzNode.ChangeName(newName);
Expand Down

0 comments on commit 56bac4c

Please sign in to comment.