diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.Designer.cs b/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.Designer.cs deleted file mode 100644 index 0f8eb007..00000000 --- a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.Designer.cs +++ /dev/null @@ -1,95 +0,0 @@ -namespace PckStudio.Forms.Additional_Popups.Audio -{ - partial class addCategory - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(addCategory)); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.cancelButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label2 - // - resources.ApplyResources(this.label2, "label2"); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Name = "label2"; - // - // button1 - // - resources.ApplyResources(this.button1, "button1"); - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Name = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // comboBox1 - // - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.FormattingEnabled = true; - resources.ApplyResources(this.comboBox1, "comboBox1"); - this.comboBox1.Name = "comboBox1"; - // - // cancelButton - // - resources.ApplyResources(this.cancelButton, "cancelButton"); - this.cancelButton.ForeColor = System.Drawing.Color.White; - this.cancelButton.Name = "cancelButton"; - this.cancelButton.UseVisualStyleBackColor = true; - this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); - // - // addCategory - // - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ControlBox = false; - this.Controls.Add(this.cancelButton); - this.Controls.Add(this.comboBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "addCategory"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.ComboBox comboBox1; - private System.Windows.Forms.Button cancelButton; - public System.Windows.Forms.Label label2; - public System.Windows.Forms.Button button1; - } -} \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.cs b/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.cs deleted file mode 100644 index e8b49ab8..00000000 --- a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Windows.Forms; - -// Audio Editor by MattNL - -namespace PckStudio.Forms.Additional_Popups.Audio -{ - public partial class addCategory : MetroFramework.Forms.MetroForm - { - private string _category = string.Empty; - public string Category => _category; - public addCategory(string[] avalibleCategories) - { - InitializeComponent(); - this.FormBorderStyle = FormBorderStyle.None; - comboBox1.Items.AddRange(avalibleCategories); - } - - private void button1_Click(object sender, EventArgs e) - { - _category = comboBox1.Text; - DialogResult = DialogResult.OK; - if(comboBox1.SelectedIndex > -1) Close(); - } - - private void cancelButton_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs new file mode 100644 index 00000000..1dbbd2a5 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs @@ -0,0 +1,96 @@ +namespace PckStudio.Forms.Additional_Popups +{ + partial class ItemSelectionPopUp + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ItemSelectionPopUp)); + this.label2 = new System.Windows.Forms.Label(); + this.okBtn = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.ComboBox = new MetroFramework.Controls.MetroComboBox(); + this.SuspendLayout(); + // + // label2 + // + resources.ApplyResources(this.label2, "label2"); + this.label2.ForeColor = System.Drawing.Color.White; + this.label2.Name = "label2"; + // + // okBtn + // + resources.ApplyResources(this.okBtn, "okBtn"); + this.okBtn.ForeColor = System.Drawing.Color.White; + this.okBtn.Name = "okBtn"; + this.okBtn.UseVisualStyleBackColor = true; + this.okBtn.Click += new System.EventHandler(this.button1_Click); + // + // cancelButton + // + resources.ApplyResources(this.cancelButton, "cancelButton"); + this.cancelButton.ForeColor = System.Drawing.Color.White; + this.cancelButton.Name = "cancelButton"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // ComboBox + // + this.ComboBox.FormattingEnabled = true; + resources.ApplyResources(this.ComboBox, "ComboBox"); + this.ComboBox.Name = "ComboBox"; + this.ComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.ComboBox.UseSelectable = true; + // + // ItemSelectionPopUp + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ControlBox = false; + this.Controls.Add(this.ComboBox); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.okBtn); + this.Controls.Add(this.label2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ItemSelectionPopUp"; + this.Resizable = false; + this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button cancelButton; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Button okBtn; + private MetroFramework.Controls.MetroComboBox ComboBox; + } +} \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs new file mode 100644 index 00000000..8f981857 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs @@ -0,0 +1,31 @@ +using System; +using System.Windows.Forms; + +// Audio Editor by MattNL + +namespace PckStudio.Forms.Additional_Popups +{ + public partial class ItemSelectionPopUp : MetroFramework.Forms.MetroForm + { + public string SelectedItem => DialogResult == DialogResult.OK ? ComboBox.Text : string.Empty; + + public ItemSelectionPopUp(string[] items) + { + InitializeComponent(); + ComboBox.Items.AddRange(items); + } + + private void button1_Click(object sender, EventArgs e) + { + if(ComboBox.SelectedIndex > -1) + cancelButton_Click(sender, e); + DialogResult = DialogResult.OK; + } + + private void cancelButton_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + } +} diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.resx b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx similarity index 99% rename from PCK-Studio/Forms/Additional-Popups/Audio/addCategory.resx rename to PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx index ec958086..3303987a 100644 --- a/PCK-Studio/Forms/Additional-Popups/Audio/addCategory.resx +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx @@ -123,16 +123,16 @@ - 5, 41 + 15, 41 - 49, 13 + 35, 13 3 - Category + Items: label2 @@ -147,54 +147,33 @@ 3 - + Flat - + 54, 76 - + 75, 23 - + 4 - + Add - - button1 + + okBtn - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 2 - - 60, 38 - - - 192, 21 - - - 5 - - - comboBox1 - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - Flat @@ -223,6 +202,30 @@ $this + 1 + + + 23 + + + 60, 34 + + + 192, 29 + + + 7 + + + ComboBox + + + MetroFramework.Controls.MetroComboBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + 0 @@ -2458,7 +2461,7 @@ CenterParent - addCategory + ItemSelectionPopUp MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs index afa1058c..b93c0c38 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.cs @@ -15,6 +15,7 @@ using PckStudio.Classes.IO.PCK; using PckStudio.Forms.Additional_Popups.Audio; using OMI.Formats.Languages; using OMI.Formats.Pck; +using PckStudio.Forms.Additional_Popups; // Audio Editor by MattNL // additional work and optimization by Miku-666 @@ -129,12 +130,12 @@ namespace PckStudio.Forms.Editor string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray(); if (available.Length > 0) { - using addCategory add = new addCategory(available); + using ItemSelectionPopUp add = new ItemSelectionPopUp(available); if (add.ShowDialog() == DialogResult.OK) - audioFile.AddCategory(GetCategoryId(add.Category)); + audioFile.AddCategory(GetCategoryId(add.SelectedItem)); else return; - var category = audioFile.GetCategory(GetCategoryId(add.Category)); + var category = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); TreeNode treeNode = new TreeNode(GetCategoryFromId(category.audioType), (int)category.audioType, (int)category.audioType); treeNode.Tag = category; treeView1.Nodes.Add(treeNode); @@ -557,15 +558,15 @@ namespace PckStudio.Forms.Editor string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray(); if (available.Length > 0) { - using addCategory add = new addCategory(available); - add.button1.Text = "Save"; + using ItemSelectionPopUp add = new ItemSelectionPopUp(available); + add.okBtn.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" : ""); + audioFile.AddCategory(category.parameterType, GetCategoryId(add.SelectedItem), category.audioType == PCKAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : ""); - var newCategory = audioFile.GetCategory(GetCategoryId(add.Category)); + var newCategory = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); category.SongNames.ForEach(c => newCategory.SongNames.Add(c)); diff --git a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs index c3df5f95..6ecfe956 100644 --- a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs +++ b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs @@ -4,14 +4,13 @@ using System.Drawing; using System.IO; using System.Linq; using System.Windows.Forms; -using PckStudio.Classes.FileTypes; using PckStudio.Forms.Additional_Popups.Grf; using PckStudio.Classes.Misc; using OMI.Formats.GameRule; using OMI.Workers.GameRule; using System.Diagnostics; -using PckStudio.Forms.Additional_Popups.Audio; using OMI.Formats.Pck; +using PckStudio.Forms.Additional_Popups; namespace PckStudio.Forms.Editor { @@ -28,11 +27,11 @@ namespace PckStudio.Forms.Editor private void PromptForCompressionType() { - addCategory dialog = new addCategory(compressionTypeComboBox.Items.Cast().ToArray()); + ItemSelectionPopUp dialog = new ItemSelectionPopUp(compressionTypeComboBox.Items.Cast().ToArray()); dialog.label2.Text = "Type"; - dialog.button1.Text = "Ok"; + dialog.okBtn.Text = "Ok"; if (dialog.ShowDialog() == DialogResult.OK) - compressionTypeComboBox.SelectedIndex = compressionTypeComboBox.Items.IndexOf(dialog.Category); + compressionTypeComboBox.SelectedIndex = compressionTypeComboBox.Items.IndexOf(dialog.SelectedItem); } public GameRuleFileEditor(PckFile.FileData file) : this() diff --git a/PCK-Studio/Forms/Utilities/Skins/ANIMEditor.cs b/PCK-Studio/Forms/Utilities/Skins/ANIMEditor.cs index 07fd8627..e3acff76 100644 --- a/PCK-Studio/Forms/Utilities/Skins/ANIMEditor.cs +++ b/PCK-Studio/Forms/Utilities/Skins/ANIMEditor.cs @@ -5,6 +5,7 @@ using System.Linq; using System.IO; using System.Windows.Forms; using PckStudio.Classes.Utils; +using PckStudio.Forms.Additional_Popups; namespace PckStudio.Forms.Utilities.Skins { @@ -261,15 +262,13 @@ namespace PckStudio.Forms.Utilities.Skins private void templateButton_Click(object sender, EventArgs e) { - // Recycling the AddCategory popup to handle the ANIM templates (: - // diag.Category will be the ANIM codes - var diag = new Additional_Popups.Audio.addCategory(Templates.Keys.ToArray()); + var diag = new ItemSelectionPopUp(Templates.Keys.ToArray()); diag.label2.Text = "Presets"; - diag.button1.Text = "Load"; + diag.okBtn.Text = "Load"; if (diag.ShowDialog() != DialogResult.OK) return; - var templateANIM = Templates[diag.Category]; + var templateANIM = Templates[diag.SelectedItem]; DialogResult prompt = MessageBox.Show(this, "Would you like to add this preset's effects to your current ANIM? Otherwise all of your effects will be cleared. Either choice can be undone by pressing \"Restore ANIM\".", "", MessageBoxButtons.YesNo); if (prompt == DialogResult.Yes) anim |= templateANIM; else anim = templateANIM; diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 560e388d..1ecc70cf 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -301,11 +301,11 @@ creditsEditor.cs - + Form - - addCategory.cs + + ItemSelectionPopUp.cs Form @@ -521,8 +521,8 @@ creditsEditor.cs Designer - - addCategory.cs + + ItemSelectionPopUp.cs addMeta.cs