From 53c9025337166a408febc15078af3e9b136b3bab Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 19 Aug 2020 15:26:25 -0700 Subject: Add natural gain accel; add scale by DPI, poll rate in GUI --- grapher/Form1.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'grapher/Form1.cs') diff --git a/grapher/Form1.cs b/grapher/Form1.cs index d8db6fc..6e08683 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Runtime.InteropServices; +using grapher.Models.Calculations; namespace grapher { @@ -131,8 +132,13 @@ namespace grapher cap, weight); + AccelCalculator accelCalculator = new AccelCalculator( + new Field(DPITextBox.TextBox, this, AccelCalculator.DefaultDPI), + new Field(PollRateTextBox.TextBox, this, AccelCalculator.DefaultPollRate)); + AccelGUI = new AccelGUI( this, + accelCalculator, accelCharts, managedAcceleration, accelerationOptions, @@ -145,7 +151,8 @@ namespace grapher limitOrExponent, midpoint, writeButton, - MouseLabel); + MouseLabel, + ScaleMenuItem); } #endregion Constructor -- cgit v1.2.3 From fe17d04e571d180e663c7014e803ce790693f4b1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 20 Aug 2020 12:51:33 -0700 Subject: Display active values --- grapher/Form1.cs | 79 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 9 deletions(-) (limited to 'grapher/Form1.cs') diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 6e08683..01e7b20 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -10,12 +10,13 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.Runtime.InteropServices; using grapher.Models.Calculations; +using grapher.Models.Options; namespace grapher { public enum accel_mode { - linear=1, classic, natural, logarithmic, sigmoid, power, noaccel + linear=1, classic, natural, logarithmic, sigmoid, power, naturalgain, sigmoidgain, noaccel } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] @@ -99,16 +100,76 @@ namespace grapher new CheckBox[] { sensXYLock, weightXYLock, capXYLock }); - var sensitivity = new OptionXY(sensitivityBoxX, sensitivityBoxY, sensXYLock, this, 1, sensitivityLabel, "Sensitivity", accelCharts); - var rotation = new Option(rotationBox, this, 0, rotationLabel, "Rotation"); - var weight = new OptionXY(weightBoxFirst, weightBoxSecond, weightXYLock, this, 1, weightLabel, "Weight", accelCharts); - var cap = new OptionXY(capBoxX, capBoxY, capXYLock, this, 0, capLabel, "Cap", accelCharts); - var offset = new Option(offsetBox, this, 0, offsetLabel, "Offset"); + var sensitivity = new OptionXY( + sensitivityBoxX, + sensitivityBoxY, + sensXYLock, + this, + 1, + sensitivityLabel, + new ActiveValueLabelXY( + new ActiveValueLabel(SensitivityActiveXLabel, ActiveValueTitle), + new ActiveValueLabel(SensitivityActiveYLabel, ActiveValueTitle)), + "Sensitivity", + accelCharts); + + var rotation = new Option( + rotationBox, + this, + 0, + rotationLabel, + new ActiveValueLabel(RotationActiveLabel, ActiveValueTitle), + "Rotation"); + + var weight = new OptionXY( + weightBoxFirst, + weightBoxSecond, + weightXYLock, + this, + 1, + weightLabel, + new ActiveValueLabelXY( + new ActiveValueLabel(WeightActiveXLabel, ActiveValueTitle), + new ActiveValueLabel(WeightActiveYLabel, ActiveValueTitle)), + "Weight", + accelCharts); + + var cap = new OptionXY( + capBoxX, + capBoxY, + capXYLock, + this, + 0, + capLabel, + new ActiveValueLabelXY( + new ActiveValueLabel(CapActiveXLabel, ActiveValueTitle), + new ActiveValueLabel(CapActiveYLabel, ActiveValueTitle)), + "Cap", + accelCharts); + + var offset = new Option( + offsetBox, + this, + 0, + offsetLabel, + new ActiveValueLabel(OffsetActiveLabel, ActiveValueTitle), + "Offset"); // The name and layout of these options is handled by AccelerationOptions object. - var acceleration = new Option(new Field(accelerationBox, this, 0), constantOneLabel); - var limitOrExponent = new Option(new Field(limitBox, this, 2), constantTwoLabel); - var midpoint = new Option(new Field(midpointBox, this, 0), constantThreeLabel); + var acceleration = new Option( + new Field(accelerationBox, this, 0), + constantOneLabel, + new ActiveValueLabel(AccelerationActiveLabel, ActiveValueTitle)); + + var limitOrExponent = new Option( + new Field(limitBox, this, 2), + constantTwoLabel, + new ActiveValueLabel(LimitExpActiveLabel, ActiveValueTitle)); + + var midpoint = new Option( + new Field(midpointBox, this, 0), + constantThreeLabel, + new ActiveValueLabel(MidpointActiveLabel, ActiveValueTitle)); var accelerationOptions = new AccelOptions( accelTypeDrop, -- cgit v1.2.3 From 7dbeae9d4cf108e78072b356d832123f12e42a90 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 20 Aug 2020 14:22:14 -0700 Subject: Add accel type to active values and tweak color --- grapher/Form1.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'grapher/Form1.cs') diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 01e7b20..1e38809 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -99,6 +99,10 @@ namespace grapher showVelocityGainToolStripMenuItem, new CheckBox[] { sensXYLock, weightXYLock, capXYLock }); + ActiveValueTitle.AutoSize = false; + ActiveValueTitle.Left = LockXYLabel.Left + LockXYLabel.Width; + ActiveValueTitle.Width = AccelerationChart.Left - ActiveValueTitle.Left; + ActiveValueTitle.TextAlign = ContentAlignment.MiddleCenter; var sensitivity = new OptionXY( sensitivityBoxX, @@ -185,7 +189,8 @@ namespace grapher weight, cap, }, - writeButton); + writeButton, + new ActiveValueLabel(AccelTypeActiveLabel, ActiveValueTitle)); var capOptions = new CapOptions( sensitivityToolStripMenuItem, -- cgit v1.2.3 From 55b739c50db217e6a61678c1eb1412e8884e3462 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 20 Aug 2020 15:46:04 -0700 Subject: Serialization mostly working --- grapher/Form1.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'grapher/Form1.cs') diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 1e38809..ef06527 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -218,7 +218,8 @@ namespace grapher midpoint, writeButton, MouseLabel, - ScaleMenuItem); + ScaleMenuItem, + AutoWriteMenuItem); } #endregion Constructor -- cgit v1.2.3 From b874058d82a60a39163e91a26f370ff308b8af32 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Sat, 22 Aug 2020 02:46:45 -0700 Subject: Saving and loading fully works --- grapher/Form1.cs | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'grapher/Form1.cs') diff --git a/grapher/Form1.cs b/grapher/Form1.cs index ef06527..d6f7990 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -11,6 +11,7 @@ using System.Windows.Forms; using System.Runtime.InteropServices; using grapher.Models.Calculations; using grapher.Models.Options; +using grapher.Models.Serialized; namespace grapher { @@ -91,6 +92,7 @@ namespace grapher Marshal.FreeHGlobal(args_ptr); + var accelCharts = new AccelCharts( this, new ChartXY(AccelerationChart, AccelerationChartY), @@ -198,15 +200,21 @@ namespace grapher cap, weight); - AccelCalculator accelCalculator = new AccelCalculator( + var accelCalculator = new AccelCalculator( new Field(DPITextBox.TextBox, this, AccelCalculator.DefaultDPI), new Field(PollRateTextBox.TextBox, this, AccelCalculator.DefaultPollRate)); + var settings = new SettingsManager( + managedAcceleration, + accelCalculator.DPI, + accelCalculator.PollRate, + AutoWriteMenuItem); + AccelGUI = new AccelGUI( this, accelCalculator, accelCharts, - managedAcceleration, + settings, accelerationOptions, sensitivity, rotation, @@ -249,21 +257,7 @@ namespace grapher private void writeButton_Click(object sender, EventArgs e) { - AccelGUI.ManagedAcceleration.UpdateAccel( - AccelGUI.AccelerationOptions.AccelerationIndex, - AccelGUI.Rotation.Field.Data, - AccelGUI.Sensitivity.Fields.X, - AccelGUI.Sensitivity.Fields.Y, - AccelGUI.Weight.Fields.X, - AccelGUI.Weight.Fields.Y, - AccelGUI.Cap.SensitivityCapX, - AccelGUI.Cap.SensitivityCapY, - AccelGUI.Offset.Field.Data, - AccelGUI.Acceleration.Field.Data, - AccelGUI.LimitOrExponent.Field.Data, - AccelGUI.Midpoint.Field.Data, - AccelGUI.Cap.VelocityGainCap); - AccelGUI.UpdateGraph(); + AccelGUI.UpdateActiveSettingsFromFields(); } #endregion Methods -- cgit v1.2.3