diff --git a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs
index 18fadace..aa9b34aa 100644
--- a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs
+++ b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs
@@ -35,6 +35,7 @@ namespace PckStudio.Forms.Editor
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addCategoryStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeCategoryStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.changeCategoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.catImages = new System.Windows.Forms.ImageList(this.components);
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -80,7 +81,8 @@ namespace PckStudio.Forms.Editor
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addCategoryStripMenuItem,
- this.removeCategoryStripMenuItem});
+ this.removeCategoryStripMenuItem,
+ this.changeCategoryToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1");
//
@@ -96,6 +98,12 @@ namespace PckStudio.Forms.Editor
resources.ApplyResources(this.removeCategoryStripMenuItem, "removeCategoryStripMenuItem");
this.removeCategoryStripMenuItem.Click += new System.EventHandler(this.removeCategoryStripMenuItem_Click);
//
+ // changeCategoryToolStripMenuItem
+ //
+ this.changeCategoryToolStripMenuItem.Name = "changeCategoryToolStripMenuItem";
+ resources.ApplyResources(this.changeCategoryToolStripMenuItem, "changeCategoryToolStripMenuItem");
+ this.changeCategoryToolStripMenuItem.Click += new System.EventHandler(this.setCategoryToolStripMenuItem_Click);
+ //
// catImages
//
this.catImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("catImages.ImageStream")));
@@ -343,5 +351,6 @@ namespace PckStudio.Forms.Editor
private MetroFramework.Controls.MetroLabel metroLabel1;
private System.Windows.Forms.ToolStripMenuItem openDataFolderToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bulkReplaceExistingTracksToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem changeCategoryToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs
index 5c5aae08..616c9183 100644
--- a/PCK-Studio/Forms/Editor/AudioEditor.cs
+++ b/PCK-Studio/Forms/Editor/AudioEditor.cs
@@ -61,6 +61,13 @@ namespace PckStudio.Forms.Editor
audioFile = PCKAudioFileReader.Read(stream, isLittleEndian);
}
+ SetUpTree();
+ }
+
+ public void SetUpTree()
+ {
+ treeView1.BeginUpdate();
+ treeView1.Nodes.Clear();
foreach (var category in audioFile.Categories)
{
if (category.Name == "include_overworld" &&
@@ -80,6 +87,7 @@ namespace PckStudio.Forms.Editor
treeView1.Nodes.Add(treeNode);
}
playOverworldInCreative.Enabled = audioFile.HasCategory(PCKAudioFile.AudioCategory.EAudioType.Creative);
+ treeView1.EndUpdate();
}
private void AudioEditor_FormClosed(object sender, FormClosedEventArgs e)
@@ -113,10 +121,10 @@ namespace PckStudio.Forms.Editor
private void addCategoryStripMenuItem_Click(object sender, EventArgs e)
{
- string[] avalible = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray();
- if (avalible.Length > 0)
+ string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray();
+ if (available.Length > 0)
{
- using addCategory add = new addCategory(avalible);
+ using addCategory add = new addCategory(available);
if (add.ShowDialog() == DialogResult.OK)
audioFile.AddCategory(GetCategoryId(add.Category));
else return;
@@ -125,10 +133,12 @@ namespace PckStudio.Forms.Editor
TreeNode treeNode = new TreeNode(GetCategoryFromId(category.audioType), (int)category.audioType, (int)category.audioType);
treeNode.Tag = category;
treeView1.Nodes.Add(treeNode);
+
+ SetUpTree();
}
else
{
- MessageBox.Show("All possible categories are used", "There are no more categories that could be added");
+ MessageBox.Show("There are no more categories that could be added", "All possible categories are used");
}
}
@@ -457,5 +467,32 @@ namespace PckStudio.Forms.Editor
Binka.ToWav(Path.Combine(parent.GetDataPath(), treeView2.SelectedNode.Text + ".binka"), Path.Combine(parent.GetDataPath()));
}
}
+
+ private void setCategoryToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (!(treeView1.SelectedNode is TreeNode t && t.Tag is PCKAudioFile.AudioCategory category)) return;
+
+ string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray();
+ if (available.Length > 0)
+ {
+ using addCategory add = new addCategory(available);
+ add.button1.Text = "Save";
+ if (add.ShowDialog() != DialogResult.OK) return;
+
+ audioFile.RemoveCategory(category.audioType);
+
+ audioFile.AddCategory(category.parameterType, GetCategoryId(add.Category), category.audioType == PCKAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : "");
+
+ var newCategory = audioFile.GetCategory(GetCategoryId(add.Category));
+
+ category.SongNames.ForEach(c => newCategory.SongNames.Add(c));
+
+ SetUpTree();
+ }
+ else
+ {
+ MessageBox.Show("There are no categories that aren't already used", "All possible categories are used");
+ }
+ }
}
}
diff --git a/PCK-Studio/Forms/Editor/AudioEditor.resx b/PCK-Studio/Forms/Editor/AudioEditor.resx
index 909eb320..f2b9e874 100644
--- a/PCK-Studio/Forms/Editor/AudioEditor.resx
+++ b/PCK-Studio/Forms/Editor/AudioEditor.resx
@@ -125,28 +125,8 @@
127, 8
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x
- DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dI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RogeQC8ivw5Vn7C0heJlFA+kL5
+ jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC
+
+
+
+ 168, 22
+
+
+ Add Category
+
+
+ 168, 22
+
+
+ Remove Category
+
+
+ 168, 22
+
+
+ Set Category
+
19, 8
False
+
+ 20, 60
+
+
+ 410, 24
+
+
+ 11
+
+
+ menuStrip1
+
+
+ menuStrip
+
+
+ System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 7
+
+
+ 37, 20
+
+
+ File
+
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
@@ -421,16 +457,16 @@
- 98, 22
+ 180, 22
Save
-
- 37, 20
+
+ 46, 20
-
- File
+
+ Tools
220, 22
@@ -456,11 +492,11 @@
Bulk Replace Existing Tracks
-
- 46, 20
+
+ 44, 20
-
- Tools
+
+ Help
243, 22
@@ -492,36 +528,6 @@
BINKA Compression
-
- 44, 20
-
-
- Help
-
-
- 20, 60
-
-
- 410, 24
-
-
- 11
-
-
- menuStrip1
-
-
- menuStrip
-
-
- System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 7
-
Top, Bottom, Left, Right
@@ -537,25 +543,25 @@
- 180, 22
+ 173, 22
Add Entry
- 180, 22
+ 173, 22
Remove Entry
- 180, 22
+ 173, 22
Verify File Location
- 181, 92
+ 174, 70
contextMenuStrip2
@@ -689,6 +695,12 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ changeCategoryToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
catImages