diff --git a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.Designer.cs deleted file mode 100644 index 7fae0a04..00000000 --- a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.Designer.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace PckStudio -{ - partial class MipMapPrompt - { - /// - /// 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(MipMapPrompt)); - this.TextLabel = new System.Windows.Forms.Label(); - this.CancelBtn = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); - this.SuspendLayout(); - // - // TextLabel - // - resources.ApplyResources(this.TextLabel, "TextLabel"); - this.TextLabel.ForeColor = System.Drawing.Color.White; - this.TextLabel.Name = "TextLabel"; - // - // CancelButton - // - resources.ApplyResources(this.CancelBtn, "CancelButton"); - this.CancelBtn.ForeColor = System.Drawing.Color.White; - this.CancelBtn.Name = "CancelButton"; - this.CancelBtn.UseVisualStyleBackColor = true; - this.CancelBtn.Click += new System.EventHandler(this.CancelButton_Click); - // - // 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.OKBtn_Click); - // - // numericUpDown1 - // - resources.ApplyResources(this.numericUpDown1, "numericUpDown1"); - this.numericUpDown1.Maximum = new decimal(new int[] { - 4, - 0, - 0, - 0}); - this.numericUpDown1.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // MipMapPrompt - // - this.AcceptButton = this.CancelBtn; - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.numericUpDown1); - this.Controls.Add(this.button1); - this.Controls.Add(this.CancelBtn); - this.Controls.Add(this.TextLabel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MipMapPrompt"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - public System.Windows.Forms.Button CancelBtn; - public System.Windows.Forms.Label TextLabel; - public System.Windows.Forms.Button button1; - private System.Windows.Forms.NumericUpDown numericUpDown1; - } -} \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.cs b/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.cs deleted file mode 100644 index 76f813e4..00000000 --- a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Windows.Forms; -using MetroFramework.Forms; - -namespace PckStudio -{ - public partial class MipMapPrompt : MetroForm - { - /// - /// Text entered only access when DialogResult == DialogResult.OK - /// - public int Levels => (int)numericUpDown1.Value; - - public MipMapPrompt() - { - InitializeComponent(); - } - - private void OKBtn_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - } - - private void CancelButton_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - } - } -} diff --git a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs new file mode 100644 index 00000000..e25dee84 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs @@ -0,0 +1,95 @@ +namespace PckStudio +{ + partial class NumericPrompt + { + /// + /// 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(NumericPrompt)); + this.TextLabel = new System.Windows.Forms.Label(); + this.OKButton = new System.Windows.Forms.Button(); + this.ContextLabel = new MetroFramework.Controls.MetroLabel(); + this.ValueUpDown = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).BeginInit(); + this.SuspendLayout(); + // + // TextLabel + // + resources.ApplyResources(this.TextLabel, "TextLabel"); + this.TextLabel.ForeColor = System.Drawing.Color.White; + this.TextLabel.Name = "TextLabel"; + // + // OKButton + // + resources.ApplyResources(this.OKButton, "OKButton"); + this.OKButton.ForeColor = System.Drawing.Color.White; + this.OKButton.Name = "OKButton"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); + // + // contextLabel + // + resources.ApplyResources(this.ContextLabel, "contextLabel"); + this.ContextLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.ContextLabel.Name = "contextLabel"; + this.ContextLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.ContextLabel.WrapToLine = true; + // + // valueUpDown + // + resources.ApplyResources(this.ValueUpDown, "valueUpDown"); + this.ValueUpDown.Name = "valueUpDown"; + // + // NumericPrompt + // + this.AcceptButton = this.OKButton; + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.ValueUpDown); + this.Controls.Add(this.ContextLabel); + this.Controls.Add(this.OKButton); + this.Controls.Add(this.TextLabel); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "NumericPrompt"; + this.Resizable = false; + this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.Load += new System.EventHandler(this.RenamePrompt_Load); + ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + public System.Windows.Forms.Button OKButton; + public System.Windows.Forms.Label TextLabel; + public MetroFramework.Controls.MetroLabel ContextLabel; + public System.Windows.Forms.NumericUpDown ValueUpDown; + } +} \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs new file mode 100644 index 00000000..3d600bea --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs @@ -0,0 +1,33 @@ +using System; +using System.Windows.Forms; +using MetroFramework.Forms; + +namespace PckStudio +{ + public partial class NumericPrompt : MetroForm + { + /// + /// Text entered only access when DialogResult == DialogResult.OK + /// + public int NewValue => (int)ValueUpDown.Value; + + public NumericPrompt(int InitialValue) + { + InitializeComponent(); + ValueUpDown.Value = InitialValue; + } + private void OKBtn_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + + private void RenamePrompt_Load(object sender, EventArgs e) + { + if(String.IsNullOrEmpty(ContextLabel.Text)) + { + ContextLabel.Visible = false; + Size = new System.Drawing.Size(264, 85); + } + } + } +} diff --git a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.resx b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx similarity index 98% rename from PCK-Studio/Forms/Additional-Popups/MipMapPrompt.resx rename to PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx index 208d5144..f1926f18 100644 --- a/PCK-Studio/Forms/Additional-Popups/MipMapPrompt.resx +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx @@ -117,22 +117,26 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bottom + True - 22, 26 + 19, 90 - 220, 13 + 34, 13 3 - How many levels would you like to generate? + Value MiddleCenter @@ -149,83 +153,85 @@ 3 - - + + Bottom + + Flat - - 135, 74 - - - 75, 23 - - - 4 - - - Cancel - - - CancelButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - Flat - - + NoControl - - 54, 74 + + 95, 118 - + 75, 23 - - 6 + + 4 - - Generate + + Set - - button1 + + OKButton - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + + 2 + + + Top + + + 28, 39 + + + 208, 39 + + + 6 + + + TopCenter + + + contextLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + 1 - - 72, 47 + + 71, 88 - - 120, 20 + + 164, 20 - + 7 - - numericUpDown1 + + valueUpDown - + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 @@ -235,7 +241,7 @@ 6, 13 - 264, 105 + 264, 150 @@ -2461,7 +2467,7 @@ CenterParent - MipMapPrompt + NumericPrompt MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 5ed13419..f2adfa59 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -1944,10 +1944,16 @@ namespace PckStudio // TGA is not yet supported if (textureExtension == ".tga") return; - using MipMapPrompt diag = new MipMapPrompt(); - if (diag.ShowDialog(this) == DialogResult.OK) + using NumericPrompt numericPrompt = new NumericPrompt(0); + numericPrompt.ValueUpDown.Minimum = 1; + numericPrompt.ValueUpDown.Maximum = 4; // 5 is the presumed max MipMap level + numericPrompt.ContextLabel.Text = "You can enter the amount of MipMap levels that you would like to generate. " + + "For example: if you enter 2, MipMapLevel1.png and MipMapLevel2.png will be generated"; + numericPrompt.TextLabel.Text = "Levels"; + + if (numericPrompt.ShowDialog(this) == DialogResult.OK) { - for (int i = 2; i < 2 + diag.Levels; i++) + for (int i = 2; i < 2 + numericPrompt.NewValue; i++) { string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}"; Debug.WriteLine(mippedPath); diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index e890385b..a2011d1c 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -177,6 +177,12 @@ + + Form + + + NumericPrompt.cs + Form @@ -268,12 +274,6 @@ CreateTexturePack.cs - - Form - - - MipMapPrompt.cs - Form @@ -499,14 +499,14 @@ CreateTexturePack.cs Designer - - MipMapPrompt.cs - Designer - AddFilePrompt.cs Designer + + NumericPrompt.cs + Designer + RenamePrompt.cs Designer