diff --git a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs index 7bead21f..753144b4 100644 --- a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.Designer.cs @@ -31,8 +31,8 @@ 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(); + this.toolTipLabel = new MetroFramework.Controls.MetroLabel(); ((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).BeginInit(); this.SuspendLayout(); // @@ -50,26 +50,26 @@ 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"; // + // toolTipLabel + // + resources.ApplyResources(this.toolTipLabel, "toolTipLabel"); + this.toolTipLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.toolTipLabel.Name = "toolTipLabel"; + this.toolTipLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.toolTipLabel.WrapToLine = true; + // // 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.toolTipLabel); this.Controls.Add(this.OKButton); this.Controls.Add(this.TextLabel); this.MaximizeBox = false; @@ -89,7 +89,7 @@ #endregion public System.Windows.Forms.Button OKButton; public System.Windows.Forms.Label TextLabel; - public MetroFramework.Controls.MetroLabel ContextLabel; private System.Windows.Forms.NumericUpDown ValueUpDown; + private MetroFramework.Controls.MetroLabel toolTipLabel; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs index 5ebf4bbf..1a674471 100644 --- a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.cs @@ -6,23 +6,60 @@ namespace PckStudio { public partial class NumericPrompt : MetroForm { - public int SelectedValue => (int)ValueUpDown.Value; + public decimal SelectedValue => ValueUpDown.Value; + + public int SelectedValueAsInt => (int)SelectedValue; - public int Minimum { set => ValueUpDown.Minimum = value; } - public int Maximum { set => ValueUpDown.Maximum = value; } + public string ToolTipText + { + get => toolTipLabel.Text; + set => toolTipLabel.Text = value; + } + + public decimal ValueStep + { + get => ValueUpDown.Increment; + set => ValueUpDown.Increment = value; + } + + public decimal Minimum + { + get => ValueUpDown.Minimum; + set => ValueUpDown.Minimum = value; + } + + public decimal Maximum + { + get => ValueUpDown.Maximum; + set => ValueUpDown.Maximum = value; + } + + private NumericPrompt() + { + InitializeComponent(); + } public NumericPrompt(int initialValue) : this(initialValue, int.MinValue, int.MaxValue) { + } + public NumericPrompt(decimal initialValue, decimal minimum, decimal maximum) + : this() + { + Minimum = minimum; + Maximum = maximum; + ValueUpDown.Value = initialValue; } public NumericPrompt(int initialValue, int minimum, int maximum) + : this((decimal)initialValue, minimum, maximum) + { + } + + public NumericPrompt(float initialValue, float minimum, float maximum) + : this((decimal)initialValue, (decimal)minimum, (decimal)maximum) { - InitializeComponent(); - ValueUpDown.Value = initialValue; - Minimum = minimum; - Maximum = maximum; } private void OKBtn_Click(object sender, EventArgs e) @@ -32,9 +69,9 @@ namespace PckStudio private void RenamePrompt_Load(object sender, EventArgs e) { - if(string.IsNullOrEmpty(ContextLabel.Text)) + if (string.IsNullOrEmpty(toolTipLabel.Text)) { - ContextLabel.Visible = false; + toolTipLabel.Visible = false; Size = new System.Drawing.Size(264, 85); } } diff --git a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx index 97fc650e..fd242b82 100644 --- a/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx +++ b/PCK-Studio/Forms/Additional-Popups/NumericPrompt.resx @@ -119,15 +119,18 @@ - Bottom + Bottom, Left True + + NoControl + - 19, 90 + 19, 38 34, 13 @@ -163,7 +166,7 @@ NoControl - 95, 118 + 83, 66 75, 23 @@ -186,38 +189,14 @@ 2 - - Top - - - 28, 27 - - - 208, 58 - - - 6 - - - TopCenter - - - ContextLabel - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 1 + + Bottom, Left, Right - 71, 88 + 71, 36 - 164, 20 + 141, 20 7 @@ -234,14 +213,47 @@ 0 + + False + + + 3, 11 + + + 235, 22 + + + 235, 22 + + + 6 + + + TopCenter + + + toolTipLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 1 + True 6, 13 + + GrowAndShrink + - 264, 150 + 241, 98 @@ -2749,6 +2761,12 @@ AP//AAA= + + 4, 2, 4, 2 + + + 0, 60, 0, 0 + CenterParent diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index b29812d2..3dd1cbcd 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -93,13 +93,13 @@ namespace PckStudio [PckFileType.UIDataFile] = _ => throw new NotSupportedException("unused in-game"), [PckFileType.InfoFile] = null, [PckFileType.TexturePackInfoFile] = HandleInnerPckFile, - [PckFileType.LocalisationFile] = HandleLocalisationFile, + [PckFileType.LocalisationFile] = HandleLocalisationFile, [PckFileType.GameRulesFile] = HandleGameRuleFile, [PckFileType.AudioFile] = HandleAudioFile, [PckFileType.ColourTableFile] = HandleColourFile, [PckFileType.GameRulesHeader] = HandleGameRuleFile, [PckFileType.SkinDataFile] = HandleInnerPckFile, - [PckFileType.ModelsFile] = null, //HandleModelsFile, // Note: Uncomment when implemented + [PckFileType.ModelsFile] = null, //HandleModelsFile, // Note: Uncomment when implemented [PckFileType.BehavioursFile] = HandleBehavioursFile, [PckFileType.MaterialFile] = HandleMaterialFile, }; @@ -1865,7 +1865,7 @@ namespace PckStudio private void SetNodeIcon(TreeNode node, PckFileType type) { - switch (type) + switch (type) { case PckFileType.AudioFile: node.ImageIndex = 1; @@ -1995,13 +1995,13 @@ namespace PckStudio using NumericPrompt numericPrompt = new NumericPrompt(0); 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. " + + numericPrompt.ToolTipText = "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.SelectedValue; i++) + for (int i = 2; i < 2 + numericPrompt.SelectedValueAsInt; i++) { string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}"; Debug.WriteLine(mippedPath);