Renamed MipMapPrompt to NumericPrompt

This commit is contained in:
MattNL
2023-06-04 20:38:37 -04:00
parent 756201296a
commit 484a49ba7a
7 changed files with 210 additions and 209 deletions

View File

@@ -1,110 +0,0 @@
namespace PckStudio
{
partial class MipMapPrompt
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@@ -1,29 +0,0 @@
using System;
using System.Windows.Forms;
using MetroFramework.Forms;
namespace PckStudio
{
public partial class MipMapPrompt : MetroForm
{
/// <summary>
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
/// </summary>
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;
}
}
}

View File

@@ -0,0 +1,95 @@
namespace PckStudio
{
partial class NumericPrompt
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Windows.Forms;
using MetroFramework.Forms;
namespace PckStudio
{
public partial class NumericPrompt : MetroForm
{
/// <summary>
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
/// </summary>
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);
}
}
}
}

View File

@@ -117,22 +117,26 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="TextLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="TextLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="TextLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>22, 26</value>
<value>19, 90</value>
</data>
<data name="TextLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 13</value>
<value>34, 13</value>
</data>
<data name="TextLabel.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="TextLabel.Text" xml:space="preserve">
<value>How many levels would you like to generate?</value>
<value>Value</value>
</data>
<data name="TextLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>MiddleCenter</value>
@@ -149,83 +153,85 @@
<data name="&gt;&gt;TextLabel.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="CancelButton.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<data name="OKButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="OKButton.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<value>Flat</value>
</data>
<data name="CancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>135, 74</value>
</data>
<data name="CancelButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="CancelButton.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="CancelButton.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="&gt;&gt;CancelButton.Name" xml:space="preserve">
<value>CancelButton</value>
</data>
<data name="&gt;&gt;CancelButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;CancelButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;CancelButton.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="button1.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
<value>Flat</value>
</data>
<data name="button1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<data name="OKButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="button1.Location" type="System.Drawing.Point, System.Drawing">
<value>54, 74</value>
<data name="OKButton.Location" type="System.Drawing.Point, System.Drawing">
<value>95, 118</value>
</data>
<data name="button1.Size" type="System.Drawing.Size, System.Drawing">
<data name="OKButton.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="button1.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
<data name="OKButton.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="button1.Text" xml:space="preserve">
<value>Generate</value>
<data name="OKButton.Text" xml:space="preserve">
<value>Set</value>
</data>
<data name="&gt;&gt;button1.Name" xml:space="preserve">
<value>button1</value>
<data name="&gt;&gt;OKButton.Name" xml:space="preserve">
<value>OKButton</value>
</data>
<data name="&gt;&gt;button1.Type" xml:space="preserve">
<data name="&gt;&gt;OKButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
<data name="&gt;&gt;OKButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
<data name="&gt;&gt;OKButton.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="contextLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top</value>
</data>
<data name="contextLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>28, 39</value>
</data>
<data name="contextLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>208, 39</value>
</data>
<data name="contextLabel.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="contextLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
<value>TopCenter</value>
</data>
<data name="&gt;&gt;contextLabel.Name" xml:space="preserve">
<value>contextLabel</value>
</data>
<data name="&gt;&gt;contextLabel.Type" xml:space="preserve">
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
</data>
<data name="&gt;&gt;contextLabel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;contextLabel.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="numericUpDown1.Location" type="System.Drawing.Point, System.Drawing">
<value>72, 47</value>
<data name="valueUpDown.Location" type="System.Drawing.Point, System.Drawing">
<value>71, 88</value>
</data>
<data name="numericUpDown1.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
<data name="valueUpDown.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 20</value>
</data>
<data name="numericUpDown1.TabIndex" type="System.Int32, mscorlib">
<data name="valueUpDown.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;numericUpDown1.Name" xml:space="preserve">
<value>numericUpDown1</value>
<data name="&gt;&gt;valueUpDown.Name" xml:space="preserve">
<value>valueUpDown</value>
</data>
<data name="&gt;&gt;numericUpDown1.Type" xml:space="preserve">
<data name="&gt;&gt;valueUpDown.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;numericUpDown1.Parent" xml:space="preserve">
<data name="&gt;&gt;valueUpDown.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;numericUpDown1.ZOrder" xml:space="preserve">
<data name="&gt;&gt;valueUpDown.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -235,7 +241,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>264, 105</value>
<value>264, 150</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@@ -2461,7 +2467,7 @@
<value>CenterParent</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>MipMapPrompt</value>
<value>NumericPrompt</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>

View File

@@ -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);

View File

@@ -177,6 +177,12 @@
<Compile Include="Extensions\ImageSection.cs" />
<Compile Include="Extensions\ListExtensions.cs" />
<Compile Include="Extensions\PckFileExtensions.cs" />
<Compile Include="Forms\Additional-Popups\NumericPrompt.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Additional-Popups\NumericPrompt.Designer.cs">
<DependentUpon>NumericPrompt.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Utilities\AppBehaviorSettingsForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -268,12 +274,6 @@
<Compile Include="Forms\Additional-Popups\CreateTexturePack.Designer.cs">
<DependentUpon>CreateTexturePack.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Additional-Popups\MipMapPrompt.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Additional-Popups\MipMapPrompt.Designer.cs">
<DependentUpon>MipMapPrompt.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Additional-Popups\AddFilePrompt.cs">
<SubType>Form</SubType>
</Compile>
@@ -499,14 +499,14 @@
<DependentUpon>CreateTexturePack.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Additional-Popups\MipMapPrompt.resx">
<DependentUpon>MipMapPrompt.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Additional-Popups\AddFilePrompt.resx">
<DependentUpon>AddFilePrompt.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Additional-Popups\NumericPrompt.resx">
<DependentUpon>NumericPrompt.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Additional-Popups\RenamePrompt.resx">
<DependentUpon>RenamePrompt.cs</DependentUpon>
<SubType>Designer</SubType>