small SetBulkSpeed changes

This commit is contained in:
MattNL
2022-08-25 15:06:23 -04:00
parent 989c16dcec
commit c98f17ebda
2 changed files with 99 additions and 135 deletions

View File

@@ -29,122 +29,108 @@ namespace PckStudio.Forms.Additional_Popups.Animation
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.metroTextBox2 = new MetroFramework.Controls.MetroTextBox();
this.label3 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.button1.Location = new System.Drawing.Point(55, 63);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 7;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label1.Location = new System.Drawing.Point(9, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 13);
this.label1.TabIndex = 10;
this.label1.Text = "Animation Time";
//
// metroTextBox2
//
//
//
//
this.metroTextBox2.CustomButton.Image = null;
this.metroTextBox2.CustomButton.Location = new System.Drawing.Point(140, 1);
this.metroTextBox2.CustomButton.Name = "";
this.metroTextBox2.CustomButton.Size = new System.Drawing.Size(21, 21);
this.metroTextBox2.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
this.metroTextBox2.CustomButton.TabIndex = 1;
this.metroTextBox2.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
this.metroTextBox2.CustomButton.UseSelectable = true;
this.metroTextBox2.CustomButton.Visible = false;
this.metroTextBox2.Lines = new string[0];
this.metroTextBox2.Location = new System.Drawing.Point(94, 32);
this.metroTextBox2.MaxLength = 4;
this.metroTextBox2.Name = "metroTextBox2";
this.metroTextBox2.PasswordChar = '\0';
this.metroTextBox2.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.metroTextBox2.SelectedText = "";
this.metroTextBox2.SelectionLength = 0;
this.metroTextBox2.SelectionStart = 0;
this.metroTextBox2.ShortcutsEnabled = true;
this.metroTextBox2.Size = new System.Drawing.Size(162, 23);
this.metroTextBox2.TabIndex = 11;
this.metroTextBox2.Theme = MetroFramework.MetroThemeStyle.Dark;
this.metroTextBox2.UseSelectable = true;
this.metroTextBox2.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.metroTextBox2.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
this.metroTextBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// label3
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label3.Location = new System.Drawing.Point(47, 13);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 13);
this.label3.TabIndex = 12;
this.label3.Text = "may/matt was here :3";
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.ForeColor = System.Drawing.Color.White;
this.button2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.button2.Location = new System.Drawing.Point(135, 63);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 13;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// SetBulkSpeed
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(264, 94);
this.ControlBox = false;
this.Controls.Add(this.button2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.metroTextBox2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(266, 96);
this.Name = "SetBulkSpeed";
this.Resizable = false;
this.Style = MetroFramework.MetroColorStyle.Silver;
this.Theme = MetroFramework.MetroThemeStyle.Dark;
this.ResumeLayout(false);
this.PerformLayout();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.TimeUpDown = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.TimeUpDown)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.button1.Location = new System.Drawing.Point(55, 63);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 7;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label1.Location = new System.Drawing.Point(9, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 13);
this.label1.TabIndex = 10;
this.label1.Text = "Animation Time";
//
// label3
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.White;
this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label3.Location = new System.Drawing.Point(47, 13);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(174, 13);
this.label3.TabIndex = 12;
this.label3.Text = "Frame Time must be greater than 0.";
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.ForeColor = System.Drawing.Color.White;
this.button2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.button2.Location = new System.Drawing.Point(135, 63);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 13;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// TimeUpDown
//
this.TimeUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
this.TimeUpDown.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TimeUpDown.ForeColor = System.Drawing.SystemColors.Window;
this.TimeUpDown.Location = new System.Drawing.Point(94, 33);
this.TimeUpDown.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.TimeUpDown.Name = "TimeUpDown";
this.TimeUpDown.Size = new System.Drawing.Size(162, 20);
this.TimeUpDown.TabIndex = 15;
this.TimeUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// SetBulkSpeed
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(264, 94);
this.ControlBox = false;
this.Controls.Add(this.button2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.TimeUpDown);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(266, 96);
this.Name = "SetBulkSpeed";
this.Resizable = false;
this.Style = MetroFramework.MetroColorStyle.Silver;
this.Theme = MetroFramework.MetroThemeStyle.Dark;
((System.ComponentModel.ISupportInitialize)(this.TimeUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private MetroFramework.Controls.MetroTextBox metroTextBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.NumericUpDown TimeUpDown;
}
}

View File

@@ -13,43 +13,21 @@ namespace PckStudio.Forms.Additional_Popups.Animation
{
public partial class SetBulkSpeed : MetroForm
{
TreeView tv;
public int time => (int)TimeUpDown.Value;
public SetBulkSpeed(TreeView treeView)
{
tv = treeView;
InitializeComponent();
label3.Text = "Frame Time must be greater than 0.";
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar);
}
private void button1_Click(object sender, EventArgs e)
{
if (metroTextBox2.Text == "" || short.Parse(metroTextBox2.Text) < 0) return;
else
{
int i = 0;
foreach (TreeNode nodes in tv.Nodes)
{
Tuple<string, string> frameData = nodes.Tag as Tuple<string, string>;
tv.Nodes.RemoveAt(i);
TreeNode frameNode = new TreeNode();
Tuple<string, string> finalFrameData = new Tuple<string, string>(frameData.Item1, metroTextBox2.Text);
frameNode.Tag = finalFrameData;
frameNode.Text = "Frame: " + frameData.Item1 + ", Frame Time: " + metroTextBox2.Text;
tv.Nodes.Insert(i, frameNode);
i++;
}
Close();
}
if (time < 0) return;
DialogResult = DialogResult.OK;
}
private void button2_Click(object sender, EventArgs e)
{
Close();
DialogResult = DialogResult.Cancel;
}
}
}