diff options
| author | Jacob Palecki <[email protected]> | 2020-09-22 15:26:08 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-22 15:26:08 -0700 |
| commit | f4ff6334df8a3fd66d13082606b69a78fa592237 (patch) | |
| tree | 6db3b486a4c19ed02d5c4368fd18d29b2abec78d /grapher | |
| parent | Save option to show velocity and gain on gui startup (diff) | |
| download | rawaccel-f4ff6334df8a3fd66d13082606b69a78fa592237.tar.xz rawaccel-f4ff6334df8a3fd66d13082606b69a78fa592237.zip | |
Remove sigmoidgain, only allow one instance of grapher to run at a time
Diffstat (limited to 'grapher')
| -rw-r--r-- | grapher/Constants/Constants.cs | 4 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/SigmoidGainLayout.cs | 22 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 22 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs | 3 | ||||
| -rw-r--r-- | grapher/Models/Serialized/DriverSettings.cs | 2 | ||||
| -rw-r--r-- | grapher/Program.cs | 10 | ||||
| -rw-r--r-- | grapher/grapher.csproj | 1 |
8 files changed, 39 insertions, 45 deletions
diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index 2ce6763..b41ffa2 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -21,9 +21,6 @@ namespace grapher /// <summary> Ratio of max (X, Y) used in "by component" calulations to those used in "whole vector" calculations. </summary> public const double XYToCombinedRatio = 1.4; - /// <summary> Possible options to display in a layout. </summary> - public const int PossibleOptionsCount = 6; - /// <summary> Separation between X and Y active value labels, in pixels. </summary> public const int ActiveLabelXYSeparation = 2; @@ -60,6 +57,7 @@ namespace grapher /// <summary> Left placement of charts when narrowed </summary> public const int NarrowChartLeft = 482; + /// <summary> Vertical placement of write button above bottom of sensitivity graph </summary> public const int WriteButtonVerticalOffset = 80; /// <summary> Format string for shortened x and y textboxes. </summary> diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index e108720..c6a895d 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -98,13 +98,13 @@ namespace grapher this.GainChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.graphsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showVelocityGainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scaleByDPIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dPIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DPITextBox = new System.Windows.Forms.ToolStripTextBox(); this.pollRateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PollRateTextBox = new System.Windows.Forms.ToolStripTextBox(); this.ScaleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showVelocityGainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showLastMouseMoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.capStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -505,12 +505,6 @@ namespace grapher this.graphsToolStripMenuItem.Size = new System.Drawing.Size(53, 20); this.graphsToolStripMenuItem.Text = "Charts"; // - // showVelocityGainToolStripMenuItem - // - this.showVelocityGainToolStripMenuItem.Name = "showVelocityGainToolStripMenuItem"; - this.showVelocityGainToolStripMenuItem.Size = new System.Drawing.Size(199, 22); - this.showVelocityGainToolStripMenuItem.Text = "Show Velocity && Gain"; - // // scaleByDPIToolStripMenuItem // this.scaleByDPIToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -526,7 +520,7 @@ namespace grapher this.dPIToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.DPITextBox}); this.dPIToolStripMenuItem.Name = "dPIToolStripMenuItem"; - this.dPIToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.dPIToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.dPIToolStripMenuItem.Text = "DPI"; // // DPITextBox @@ -540,7 +534,7 @@ namespace grapher this.pollRateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.PollRateTextBox}); this.pollRateToolStripMenuItem.Name = "pollRateToolStripMenuItem"; - this.pollRateToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pollRateToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.pollRateToolStripMenuItem.Text = "Poll Rate"; // // PollRateTextBox @@ -552,9 +546,15 @@ namespace grapher // ScaleMenuItem // this.ScaleMenuItem.Name = "ScaleMenuItem"; - this.ScaleMenuItem.Size = new System.Drawing.Size(180, 22); + this.ScaleMenuItem.Size = new System.Drawing.Size(169, 22); this.ScaleMenuItem.Text = "Re-scale by above"; // + // showVelocityGainToolStripMenuItem + // + this.showVelocityGainToolStripMenuItem.Name = "showVelocityGainToolStripMenuItem"; + this.showVelocityGainToolStripMenuItem.Size = new System.Drawing.Size(199, 22); + this.showVelocityGainToolStripMenuItem.Text = "Show Velocity && Gain"; + // // showLastMouseMoveToolStripMenuItem // this.showLastMouseMoveToolStripMenuItem.Checked = true; diff --git a/grapher/Layouts/SigmoidGainLayout.cs b/grapher/Layouts/SigmoidGainLayout.cs deleted file mode 100644 index 684de83..0000000 --- a/grapher/Layouts/SigmoidGainLayout.cs +++ /dev/null @@ -1,22 +0,0 @@ -using grapher.Models.Serialized; - -namespace grapher.Layouts -{ - public class SigmoidGainLayout : LayoutBase - { - public SigmoidGainLayout() - : base() - { - Name = "SigmoidGain"; - Index = (int)AccelMode.sigmoidgain; - LogarithmicCharts = false; - - AccelLayout = new OptionLayout(true, Acceleration); - CapLayout = new OptionLayout(false, string.Empty); - WeightLayout = new OptionLayout(true, Weight); - OffsetLayout = new OptionLayout(false, string.Empty); - LimExpLayout = new OptionLayout(true, Limit); - MidpointLayout = new OptionLayout(true, Midpoint); - } - } -} diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 253804e..c30c993 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -211,16 +211,26 @@ namespace grapher public void SetMinMax(double min, double max) { - ChartX.ChartAreas[0].AxisY.Minimum = min; - ChartX.ChartAreas[0].AxisY.Maximum = max; + if (min < max) + { + ChartX.ChartAreas[0].AxisY.Minimum = min; + ChartX.ChartAreas[0].AxisY.Maximum = max; + } } public void SetMinMaxXY(double minX, double maxX, double minY, double maxY) { - ChartX.ChartAreas[0].AxisY.Minimum = minX; - ChartX.ChartAreas[0].AxisY.Maximum = maxX; - ChartY.ChartAreas[0].AxisY.Minimum = minY; - ChartY.ChartAreas[0].AxisY.Maximum = maxY; + if (minX < maxX) + { + ChartX.ChartAreas[0].AxisY.Minimum = minX; + ChartX.ChartAreas[0].AxisY.Maximum = maxX; + } + + if (minY < maxY) + { + ChartY.ChartAreas[0].AxisY.Minimum = minY; + ChartY.ChartAreas[0].AxisY.Maximum = maxY; + } } public void SetCombined() diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index 16029ce..9bd42f5 100644 --- a/grapher/Models/Options/AccelTypeOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -17,10 +17,9 @@ namespace grapher new LinearLayout(), new ClassicLayout(), new NaturalLayout(), + new NaturalGainLayout(), new PowerLayout(), new LogarithmLayout(), - new NaturalGainLayout(), - new SigmoidGainLayout(), new MotivityLayout(), new OffLayout() }.ToDictionary(k => k.Name); diff --git a/grapher/Models/Serialized/DriverSettings.cs b/grapher/Models/Serialized/DriverSettings.cs index 119b684..5f9307c 100644 --- a/grapher/Models/Serialized/DriverSettings.cs +++ b/grapher/Models/Serialized/DriverSettings.cs @@ -8,7 +8,7 @@ namespace grapher.Models.Serialized public enum AccelMode { - linear, classic, natural, naturalgain, sigmoidgain, power, logarithm, motivity, noaccel + linear, classic, natural, naturalgain, power, logarithm, motivity, noaccel } #endregion Enumerations diff --git a/grapher/Program.cs b/grapher/Program.cs index 85fd040..485e074 100644 --- a/grapher/Program.cs +++ b/grapher/Program.cs @@ -11,9 +11,19 @@ namespace grapher [STAThread] static void Main() { + var mutex = new System.Threading.Mutex(true, "RawAccelGrapher", out bool result); + + if (!result) + { + MessageBox.Show("Another instance of the Raw Accel Grapher is already running."); + return; + } + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new RawAcceleration()); + + GC.KeepAlive(mutex); } } } diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj index b283e37..bc9fcf2 100644 --- a/grapher/grapher.csproj +++ b/grapher/grapher.csproj @@ -57,7 +57,6 @@ <Compile Include="Layouts\MotivityLayout.cs" /> <Compile Include="Layouts\LogarithmLayout.cs" /> <Compile Include="Layouts\NaturalGainLayout.cs" /> - <Compile Include="Layouts\SigmoidGainLayout.cs" /> <Compile Include="Models\AccelGUIFactory.cs" /> <Compile Include="Models\Calculations\AccelCalculator.cs" /> <Compile Include="Models\Calculations\AccelChartData.cs" /> |