From e73737a20a5ebe6bf0e3d9ab6b8bf3abe2c0ff79 Mon Sep 17 00:00:00 2001
From: adelikat <adelikat@tasvideos.org>
Date: Sun, 6 Sep 2015 20:28:37 -0400
Subject: [PATCH] BasicBot - add sliders to probabilities

---
 .../tools/BasicBot/BotControlsRow.Designer.cs | 25 ++++++++++++++++---
 .../tools/BasicBot/BotControlsRow.cs          | 16 ++++++++++++
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.Designer.cs b/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.Designer.cs
index 6349189629..81655e6afe 100644
--- a/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.Designer.cs
+++ b/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.Designer.cs
@@ -30,7 +30,9 @@
 		{
 			this.ButtonNameLabel = new System.Windows.Forms.Label();
 			this.ProbabilityUpDown = new System.Windows.Forms.NumericUpDown();
+			this.ProbabilitySlider = new System.Windows.Forms.TrackBar();
 			((System.ComponentModel.ISupportInitialize)(this.ProbabilityUpDown)).BeginInit();
+			((System.ComponentModel.ISupportInitialize)(this.ProbabilitySlider)).BeginInit();
 			this.SuspendLayout();
 			// 
 			// ButtonNameLabel
@@ -44,28 +46,42 @@
 			// 
 			// ProbabilityUpDown
 			// 
-			this.ProbabilityUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
 			this.ProbabilityUpDown.DecimalPlaces = 1;
 			this.ProbabilityUpDown.Increment = new decimal(new int[] {
             1,
             0,
             0,
             65536});
-			this.ProbabilityUpDown.Location = new System.Drawing.Point(81, -2);
+			this.ProbabilityUpDown.Location = new System.Drawing.Point(92, 0);
 			this.ProbabilityUpDown.Name = "ProbabilityUpDown";
-			this.ProbabilityUpDown.Size = new System.Drawing.Size(79, 20);
+			this.ProbabilityUpDown.Size = new System.Drawing.Size(49, 20);
 			this.ProbabilityUpDown.TabIndex = 1;
+			this.ProbabilityUpDown.ValueChanged += new System.EventHandler(this.ProbabilityUpDown_ValueChanged);
+			// 
+			// ProbabilitySlider
+			// 
+			this.ProbabilitySlider.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+			this.ProbabilitySlider.Location = new System.Drawing.Point(147, -2);
+			this.ProbabilitySlider.Maximum = 100;
+			this.ProbabilitySlider.Name = "ProbabilitySlider";
+			this.ProbabilitySlider.Size = new System.Drawing.Size(111, 45);
+			this.ProbabilitySlider.TabIndex = 2;
+			this.ProbabilitySlider.TickFrequency = 25;
+			this.ProbabilitySlider.ValueChanged += new System.EventHandler(this.ProbabilitySlider_ValueChanged);
 			// 
 			// BotControlsRow
 			// 
 			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
 			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.Controls.Add(this.ProbabilitySlider);
 			this.Controls.Add(this.ProbabilityUpDown);
 			this.Controls.Add(this.ButtonNameLabel);
 			this.Name = "BotControlsRow";
-			this.Size = new System.Drawing.Size(163, 20);
+			this.Size = new System.Drawing.Size(258, 29);
 			this.Load += new System.EventHandler(this.BotControlsRow_Load);
 			((System.ComponentModel.ISupportInitialize)(this.ProbabilityUpDown)).EndInit();
+			((System.ComponentModel.ISupportInitialize)(this.ProbabilitySlider)).EndInit();
 			this.ResumeLayout(false);
 			this.PerformLayout();
 
@@ -75,5 +91,6 @@
 
 		private System.Windows.Forms.Label ButtonNameLabel;
 		private System.Windows.Forms.NumericUpDown ProbabilityUpDown;
+		private System.Windows.Forms.TrackBar ProbabilitySlider;
 	}
 }
diff --git a/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.cs b/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.cs
index c2174f86ed..474a998eec 100644
--- a/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.cs
+++ b/BizHawk.Client.EmuHawk/tools/BasicBot/BotControlsRow.cs
@@ -5,6 +5,8 @@ namespace BizHawk.Client.EmuHawk
 {
 	public partial class BotControlsRow : UserControl
 	{
+		private bool _programmaticallyChangingValues;
+
 		public BotControlsRow()
 		{
 			InitializeComponent();
@@ -26,5 +28,19 @@ namespace BizHawk.Client.EmuHawk
 		{
 
 		}
+
+		private void ProbabilityUpDown_ValueChanged(object sender, EventArgs e)
+		{
+			_programmaticallyChangingValues = true;
+			ProbabilitySlider.Value = (int)ProbabilityUpDown.Value;
+			_programmaticallyChangingValues = false;
+		}
+
+		private void ProbabilitySlider_ValueChanged(object sender, EventArgs e)
+		{
+			_programmaticallyChangingValues = true;
+			ProbabilityUpDown.Value = ProbabilitySlider.Value;
+			_programmaticallyChangingValues = false;
+		}
 	}
 }