From 08c536c35bd99fd1e75d5040b68effe0c105003d Mon Sep 17 00:00:00 2001 From: MattNL Date: Wed, 15 Mar 2023 11:31:23 -0400 Subject: [PATCH] Checkbox now only shows when appropriate --- .../Forms/Editor/AudioEditor.Designer.cs | 14 +- PCK-Studio/Forms/Editor/AudioEditor.cs | 29 ++- PCK-Studio/Forms/Editor/AudioEditor.resx | 213 +++++++++--------- 3 files changed, 137 insertions(+), 119 deletions(-) diff --git a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs index 4eb84bce..bd643284 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs @@ -45,6 +45,7 @@ namespace PckStudio.Forms.Editor this.deleteUnusedBINKAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openDataFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bulkReplaceExistingTracksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.organizeTracksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.howToAddSongsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.whatAreTheCategoriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -59,7 +60,6 @@ namespace PckStudio.Forms.Editor this.playOverworldInCreative = new MetroFramework.Controls.MetroCheckBox(); this.compressionUpDown = new System.Windows.Forms.NumericUpDown(); this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); - this.organizeTracksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.menuStrip.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); @@ -179,6 +179,12 @@ namespace PckStudio.Forms.Editor resources.ApplyResources(this.bulkReplaceExistingTracksToolStripMenuItem, "bulkReplaceExistingTracksToolStripMenuItem"); this.bulkReplaceExistingTracksToolStripMenuItem.Click += new System.EventHandler(this.bulkReplaceExistingFilesToolStripMenuItem_Click); // + // organizeTracksToolStripMenuItem + // + this.organizeTracksToolStripMenuItem.Name = "organizeTracksToolStripMenuItem"; + resources.ApplyResources(this.organizeTracksToolStripMenuItem, "organizeTracksToolStripMenuItem"); + this.organizeTracksToolStripMenuItem.Click += new System.EventHandler(this.organizeTracksToolStripMenuItem_Click); + // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -299,12 +305,6 @@ namespace PckStudio.Forms.Editor this.metroLabel1.Name = "metroLabel1"; this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // - // organizeTracksToolStripMenuItem - // - this.organizeTracksToolStripMenuItem.Name = "organizeTracksToolStripMenuItem"; - resources.ApplyResources(this.organizeTracksToolStripMenuItem, "organizeTracksToolStripMenuItem"); - this.organizeTracksToolStripMenuItem.Click += new System.EventHandler(this.organizeTracksToolStripMenuItem_Click); - // // AudioEditor // resources.ApplyResources(this, "$this"); diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs index b93c0c38..5f47eb52 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.cs @@ -76,16 +76,19 @@ namespace PckStudio.Forms.Editor treeView1.Nodes.Clear(); foreach (var category in audioFile.Categories) { - if (category.Name == "include_overworld" && - category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative && - audioFile.TryGetCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld, out PCKAudioFile.AudioCategory overworldCategory)) + if(category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative) { - foreach (var name in category.SongNames.ToList()) + if (category.Name == "include_overworld" && + audioFile.TryGetCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld, out PCKAudioFile.AudioCategory overworldCategory)) { - if (overworldCategory.SongNames.Contains(name)) - category.SongNames.Remove(name); + foreach (var name in category.SongNames.ToList()) + { + if (overworldCategory.SongNames.Contains(name)) + category.SongNames.Remove(name); + } + playOverworldInCreative.Checked = true; } - playOverworldInCreative.Checked = true; + playOverworldInCreative.Visible = true; } TreeNode treeNode = new TreeNode(GetCategoryFromId(category.audioType), (int)category.audioType, (int)category.audioType); @@ -136,6 +139,13 @@ namespace PckStudio.Forms.Editor else return; var category = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); + + if (GetCategoryId(add.SelectedItem) == PCKAudioFile.AudioCategory.EAudioType.Creative) + { + playOverworldInCreative.Visible = true; + playOverworldInCreative.Checked = false; + } + TreeNode treeNode = new TreeNode(GetCategoryFromId(category.audioType), (int)category.audioType, (int)category.audioType); treeNode.Tag = category; treeView1.Nodes.Add(treeNode); @@ -171,6 +181,11 @@ namespace PckStudio.Forms.Editor if (treeView1.SelectedNode is TreeNode main && audioFile.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text))) { + if(GetCategoryId(treeView1.SelectedNode.Text) == PCKAudioFile.AudioCategory.EAudioType.Creative) + { + playOverworldInCreative.Visible = false; + playOverworldInCreative.Checked = false; + } treeView2.Nodes.Clear(); main.Remove(); } diff --git a/PCK-Studio/Forms/Editor/AudioEditor.resx b/PCK-Studio/Forms/Editor/AudioEditor.resx index 8240c774..ea023737 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.resx +++ b/PCK-Studio/Forms/Editor/AudioEditor.resx @@ -125,6 +125,32 @@ 127, 8 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x + DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 + jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC + + + + 168, 22 + + + Add Category + + + 168, 22 + + + Remove Category + + + 168, 22 + + + Set Category + 169, 70 @@ -146,7 +172,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADk - MAAAAk1TRnQBSQFMAgEBCQEAAZgBAAGYAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + MAAAAk1TRnQBSQFMAgEBCQEAAaABAAGgAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABMAMAAQEBAAEgBgABMBIAAzgB/wM1Af8DNQH/AzMB/wMwAf8DLwH/Ay0B/wMtAf8DJAH/AzsB/wM4 Af8DNQH/Ay0B/wMnAf8DNgH/AzIB/8AAAzgB/wN/Af8DeQH/A3kB/wN5Af8DcQH/A3EB/wN5Af8DeQH/ A3EB/wNxAf8DcQH/A3kB/wN5Af8DfwH/AzIB/8AAAzIB/wN2Af8DsAH/A7AB/wOvAf8DrwH/A68B/wOo @@ -384,38 +410,28 @@ 5 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x - DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 - jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC - - - - 168, 22 - - - Add Category - - - 168, 22 - - - Remove Category - - - 168, 22 - - - Set Category - 19, 8 False + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADfSURBVDhPYxg8 + QLt++3yTGbf/Fm599P/Nh49wfPXxq/+rTt37f+Dak/8gOSBgAGEMANIMxGBFyAasPf/0v8GE8//z1t8C + y4HU4DIALIluwLpLL+HiMANAGKoNAWASCavv/n/57gPcgOvP3oENOXj7NViOoAFGU6791+k4ghWD5Aga + QCyGakMAkODcU89R/I8Ng9TgNADk14dPn/8/c+kqVgySgwUqVBsCwAx49urN/zsPHmPFIDmaGvAXJInN + 38gYasBfqDYE0K7dOn/Wvut/sfkdGYPUgJI9VNuAAwYGAGn6yvdevWgPAAAAAElFTkSuQmCC + + + + 98, 22 + + + Save + 37, 20 @@ -458,52 +474,6 @@ Tools - - 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 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADfSURBVDhPYxg8 - QLt++3yTGbf/Fm599P/Nh49wfPXxq/+rTt37f+Dak/8gOSBgAGEMANIMxGBFyAasPf/0v8GE8//z1t8C - y4HU4DIALIluwLpLL+HiMANAGKoNAWASCavv/n/57gPcgOvP3oENOXj7NViOoAFGU6791+k4ghWD5Aga - QCyGakMAkODcU89R/I8Ng9TgNADk14dPn/8/c+kqVgySgwUqVBsCwAx49urN/zsPHmPFIDmaGvAXJInN - 38gYasBfqDYE0K7dOn/Wvut/sfkdGYPUgJI9VNuAAwYGAGn6yvdevWgPAAAAAElFTkSuQmCC - - - - 98, 22 - - - Save - 243, 22 @@ -534,12 +504,68 @@ 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 282, 8 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x + DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 + jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC + + + + 173, 22 + + + Add Entry + + + 173, 22 + + + Remove Entry + + + 173, 22 + + + Verify File Location + 174, 70 @@ -570,32 +596,6 @@ 6 - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x - DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 - jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC - - - - 173, 22 - - - Add Entry - - - 173, 22 - - - Remove Entry - - - 173, 22 - - - Verify File Location - True @@ -611,6 +611,9 @@ Play overworld songs in Creative + + False + playOverworldInCreative @@ -758,6 +761,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + organizeTracksToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + helpToolStripMenuItem @@ -812,12 +821,6 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - organizeTracksToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - AudioEditor