Added "Edit All Entries" tool to MetaContextMenu

This commit is contained in:
MattNL
2022-11-30 15:04:48 -05:00
parent 31c2db2de0
commit acd0e7e313
3 changed files with 560 additions and 644 deletions

View File

@@ -139,6 +139,7 @@
this.imageList = new System.Windows.Forms.ImageList(this.components);
this.pictureBoxImagePreview = new PckStudio.PictureBoxWithInterpolationMode();
this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.editAllEntriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuPCKEntries.SuspendLayout();
this.menuStrip.SuspendLayout();
this.contextMenuMetaTree.SuspendLayout();
@@ -725,7 +726,8 @@
this.contextMenuMetaTree.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addEntryToolStripMenuItem,
this.addMultipleEntriesToolStripMenuItem1,
this.deleteEntryToolStripMenuItem});
this.deleteEntryToolStripMenuItem,
this.editAllEntriesToolStripMenuItem});
this.contextMenuMetaTree.Name = "contextMenuStrip1";
resources.ApplyResources(this.contextMenuMetaTree, "contextMenuMetaTree");
//
@@ -1024,6 +1026,12 @@
this.LittleEndianCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
this.LittleEndianCheckBox.UseSelectable = true;
//
// editAllEntriesToolStripMenuItem
//
this.editAllEntriesToolStripMenuItem.Name = "editAllEntriesToolStripMenuItem";
resources.ApplyResources(this.editAllEntriesToolStripMenuItem, "editAllEntriesToolStripMenuItem");
this.editAllEntriesToolStripMenuItem.Click += new System.EventHandler(this.editAllEntriesToolStripMenuItem_Click);
//
// MainForm
//
this.ApplyImageInvert = true;
@@ -1172,6 +1180,7 @@
private System.Windows.Forms.ToolStripMenuItem miscToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addCustomPackImageToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem CreateSkinsPCKToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem editAllEntriesToolStripMenuItem;
}
}

View File

@@ -2165,5 +2165,32 @@ namespace PckStudio
folderNode.SelectedImageIndex = 0;
skinsNode.Nodes.Add(folderNode);
}
private void editAllEntriesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (treeViewMain.SelectedNode is TreeNode t &&
t.Tag is PCKFile.FileData file)
{
List<string> props = new List<string>();
file.properties.ForEach(l => props.Add(l.property + " " + l.value));
using (var input = new TextPrompt(props.ToArray()))
{
if (input.ShowDialog(this) == DialogResult.OK)
{
file.properties.Clear();
foreach (var line in input.TextOutput)
{
int idx = line.IndexOf(' ');
if (idx == -1 || line.Length - 1 == idx)
continue;
file.properties.Add((line.Substring(0, idx), line.Substring(idx + 1)));
}
ReloadMetaTreeView();
if (IsSubPCKNode(t.FullPath)) RebuildSubPCK(t);
saved = false;
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff