mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-26 03:05:10 +00:00
NumericPrompt - Hide ValueUpDown control and added setter for min and max
This commit is contained in:
@@ -28,61 +28,61 @@
|
||||
/// </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();
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@@ -90,6 +90,6 @@
|
||||
public System.Windows.Forms.Button OKButton;
|
||||
public System.Windows.Forms.Label TextLabel;
|
||||
public MetroFramework.Controls.MetroLabel ContextLabel;
|
||||
public System.Windows.Forms.NumericUpDown ValueUpDown;
|
||||
}
|
||||
private System.Windows.Forms.NumericUpDown ValueUpDown;
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,23 @@ namespace PckStudio
|
||||
/// <summary>
|
||||
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
|
||||
/// </summary>
|
||||
public int NewValue => (int)ValueUpDown.Value;
|
||||
public int SelectedValue => (int)ValueUpDown.Value;
|
||||
|
||||
public NumericPrompt(int InitialValue)
|
||||
public int Minimum { set => ValueUpDown.Minimum = value; }
|
||||
public int Maximum { set => ValueUpDown.Maximum = value; }
|
||||
|
||||
public NumericPrompt(int initialValue)
|
||||
: this(initialValue, 0, 100)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NumericPrompt(int initialValue, int minimum, int maximum)
|
||||
{
|
||||
InitializeComponent();
|
||||
ValueUpDown.Value = InitialValue;
|
||||
ValueUpDown.Value = initialValue;
|
||||
Minimum = minimum;
|
||||
Maximum = maximum;
|
||||
}
|
||||
private void OKBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -23,7 +34,7 @@ namespace PckStudio
|
||||
|
||||
private void RenamePrompt_Load(object sender, EventArgs e)
|
||||
{
|
||||
if(String.IsNullOrEmpty(ContextLabel.Text))
|
||||
if(string.IsNullOrEmpty(ContextLabel.Text))
|
||||
{
|
||||
ContextLabel.Visible = false;
|
||||
Size = new System.Drawing.Size(264, 85);
|
||||
|
||||
@@ -186,52 +186,52 @@
|
||||
<data name=">>OKButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="contextLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<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">
|
||||
<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">
|
||||
<data name="ContextLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>208, 39</value>
|
||||
</data>
|
||||
<data name="contextLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="ContextLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="contextLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<data name="ContextLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
</data>
|
||||
<data name=">>contextLabel.Name" xml:space="preserve">
|
||||
<value>contextLabel</value>
|
||||
<data name=">>ContextLabel.Name" xml:space="preserve">
|
||||
<value>ContextLabel</value>
|
||||
</data>
|
||||
<data name=">>contextLabel.Type" xml:space="preserve">
|
||||
<data name=">>ContextLabel.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>contextLabel.Parent" xml:space="preserve">
|
||||
<data name=">>ContextLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>contextLabel.ZOrder" xml:space="preserve">
|
||||
<data name=">>ContextLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="valueUpDown.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="ValueUpDown.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>71, 88</value>
|
||||
</data>
|
||||
<data name="valueUpDown.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="ValueUpDown.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>164, 20</value>
|
||||
</data>
|
||||
<data name="valueUpDown.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="ValueUpDown.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name=">>valueUpDown.Name" xml:space="preserve">
|
||||
<value>valueUpDown</value>
|
||||
<data name=">>ValueUpDown.Name" xml:space="preserve">
|
||||
<value>ValueUpDown</value>
|
||||
</data>
|
||||
<data name=">>valueUpDown.Type" xml:space="preserve">
|
||||
<data name=">>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=">>valueUpDown.Parent" xml:space="preserve">
|
||||
<data name=">>ValueUpDown.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>valueUpDown.ZOrder" xml:space="preserve">
|
||||
<data name=">>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">
|
||||
|
||||
@@ -1949,15 +1949,15 @@ namespace PckStudio
|
||||
if (textureExtension == ".tga") return;
|
||||
|
||||
using NumericPrompt numericPrompt = new NumericPrompt(0);
|
||||
numericPrompt.ValueUpDown.Minimum = 1;
|
||||
numericPrompt.ValueUpDown.Maximum = 4; // 5 is the presumed max MipMap level
|
||||
numericPrompt.Minimum = 1;
|
||||
numericPrompt.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 + numericPrompt.NewValue; i++)
|
||||
for (int i = 2; i < 2 + numericPrompt.SelectedValue; i++)
|
||||
{
|
||||
string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}";
|
||||
Debug.WriteLine(mippedPath);
|
||||
|
||||
Reference in New Issue
Block a user