diff options
| author | Jacob Palecki <[email protected]> | 2021-09-14 00:55:21 -0700 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:34:51 -0400 |
| commit | 6c037f92a350d8622f3739b1033c909912860d77 (patch) | |
| tree | d8ddfa354176b0fa43713e47e8424cd466b6eeaa | |
| parent | Some reorganizing (diff) | |
| download | rawaccel-6c037f92a350d8622f3739b1033c909912860d77.tar.xz rawaccel-6c037f92a350d8622f3739b1033c909912860d77.zip | |
Mostly working cap type in GUI
| -rw-r--r-- | common/math-vec2.hpp | 8 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 254 | ||||
| -rw-r--r-- | grapher/Form1.cs | 28 | ||||
| -rw-r--r-- | grapher/Layouts/ClassicLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/DefaultLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/JumpLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/LUTLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 35 | ||||
| -rw-r--r-- | grapher/Layouts/LinearLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/MotivityLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/OffLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/UnsupportedLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 123 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs | 75 | ||||
| -rw-r--r-- | grapher/Models/Options/Cap/CapOptions.cs | 107 | ||||
| -rw-r--r-- | grapher/Models/Options/Cap/CapTypeOptions.cs | 11 |
18 files changed, 481 insertions, 210 deletions
diff --git a/common/math-vec2.hpp b/common/math-vec2.hpp index a7656ed..f84c4c0 100644 --- a/common/math-vec2.hpp +++ b/common/math-vec2.hpp @@ -30,16 +30,8 @@ inline double magnitude(const vec2d& v) return sqrt(v.x * v.x + v.y * v.y); } -inline double lp_infinite_distance(const vec2d& v) -{ - return abs(v.x) > abs(v.y) ? abs(v.x) : abs(v.y); -} inline double lp_distance(const vec2d& v, double p) { - if (p > 64) { - return lp_infinite_distance(v); - } - return pow(pow(v.x, p) + pow(v.y, p), 1 / p); } diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 0356683..532eab4 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -154,7 +154,7 @@ namespace grapher this.limitLabelY = new System.Windows.Forms.Label(); this.offsetLabelY = new System.Windows.Forms.Label(); this.weightLabelY = new System.Windows.Forms.Label(); - this.capLabelY = new System.Windows.Forms.Label(); + this.inCapLabelY = new System.Windows.Forms.Label(); this.constantOneLabelY = new System.Windows.Forms.Label(); this.ByComponentXYLock = new System.Windows.Forms.CheckBox(); this.MidpointActiveYLabel = new System.Windows.Forms.Label(); @@ -169,10 +169,10 @@ namespace grapher this.MidpointActiveXLabel = new System.Windows.Forms.Label(); this.LimitActiveXLabel = new System.Windows.Forms.Label(); this.OffsetActiveXLabel = new System.Windows.Forms.Label(); - this.CapActiveYLabel = new System.Windows.Forms.Label(); + this.InCapActiveYLabel = new System.Windows.Forms.Label(); this.WeightActiveYLabel = new System.Windows.Forms.Label(); this.WeightActiveXLabel = new System.Windows.Forms.Label(); - this.CapActiveXLabel = new System.Windows.Forms.Label(); + this.InCapActiveXLabel = new System.Windows.Forms.Label(); this.AccelerationActiveLabelX = new System.Windows.Forms.Label(); this.AccelTypeActiveLabelX = new System.Windows.Forms.Label(); this.RotationActiveLabel = new System.Windows.Forms.Label(); @@ -182,7 +182,7 @@ namespace grapher this.MouseLabel = new System.Windows.Forms.Label(); this.LockXYLabel = new System.Windows.Forms.Label(); this.sensXYLock = new System.Windows.Forms.CheckBox(); - this.capBoxY = new System.Windows.Forms.TextBox(); + this.inCapBoxY = new System.Windows.Forms.TextBox(); this.VertHorzRatioBox = new System.Windows.Forms.TextBox(); this.writeButton = new System.Windows.Forms.Button(); this.offsetLabelX = new System.Windows.Forms.Label(); @@ -194,8 +194,8 @@ namespace grapher this.weightBoxY = new System.Windows.Forms.TextBox(); this.weightLabelX = new System.Windows.Forms.Label(); this.weightBoxX = new System.Windows.Forms.TextBox(); - this.capLabelX = new System.Windows.Forms.Label(); - this.capBoxX = new System.Windows.Forms.TextBox(); + this.inCapLabelX = new System.Windows.Forms.Label(); + this.inCapBoxX = new System.Windows.Forms.TextBox(); this.constantOneLabelX = new System.Windows.Forms.Label(); this.accelerationBoxX = new System.Windows.Forms.TextBox(); this.rotationLabel = new System.Windows.Forms.Label(); @@ -224,6 +224,18 @@ namespace grapher this.GainChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.VelocityChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.CapTypeDropdownX = new System.Windows.Forms.ComboBox(); + this.CapTypeDropdownY = new System.Windows.Forms.ComboBox(); + this.CapTypeLabelX = new System.Windows.Forms.Label(); + this.CapTypeLabelY = new System.Windows.Forms.Label(); + this.outCapBoxX = new System.Windows.Forms.TextBox(); + this.outCapBoxY = new System.Windows.Forms.TextBox(); + this.outCapLabelX = new System.Windows.Forms.Label(); + this.outCapLabelY = new System.Windows.Forms.Label(); + this.OutCapActiveXLabel = new System.Windows.Forms.Label(); + this.OutCapActiveYLabel = new System.Windows.Forms.Label(); + this.CapTypeActiveXLabel = new System.Windows.Forms.Label(); + this.CapTypeActiveYLabel = new System.Windows.Forms.Label(); this.optionsPanel.SuspendLayout(); this.DirectionalityPanel.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -239,6 +251,18 @@ namespace grapher // optionsPanel // this.optionsPanel.AutoSize = true; + this.optionsPanel.Controls.Add(this.CapTypeActiveYLabel); + this.optionsPanel.Controls.Add(this.CapTypeActiveXLabel); + this.optionsPanel.Controls.Add(this.OutCapActiveYLabel); + this.optionsPanel.Controls.Add(this.OutCapActiveXLabel); + this.optionsPanel.Controls.Add(this.outCapLabelY); + this.optionsPanel.Controls.Add(this.outCapLabelX); + this.optionsPanel.Controls.Add(this.outCapBoxY); + this.optionsPanel.Controls.Add(this.outCapBoxX); + this.optionsPanel.Controls.Add(this.CapTypeLabelY); + this.optionsPanel.Controls.Add(this.CapTypeLabelX); + this.optionsPanel.Controls.Add(this.CapTypeDropdownY); + this.optionsPanel.Controls.Add(this.CapTypeDropdownX); this.optionsPanel.Controls.Add(this.VertHorzRatioLabel); this.optionsPanel.Controls.Add(this.SmoothActiveYLabel); this.optionsPanel.Controls.Add(this.smoothLabelY); @@ -303,7 +327,7 @@ namespace grapher this.optionsPanel.Controls.Add(this.limitLabelY); this.optionsPanel.Controls.Add(this.offsetLabelY); this.optionsPanel.Controls.Add(this.weightLabelY); - this.optionsPanel.Controls.Add(this.capLabelY); + this.optionsPanel.Controls.Add(this.inCapLabelY); this.optionsPanel.Controls.Add(this.constantOneLabelY); this.optionsPanel.Controls.Add(this.ByComponentXYLock); this.optionsPanel.Controls.Add(this.MidpointActiveYLabel); @@ -318,10 +342,10 @@ namespace grapher this.optionsPanel.Controls.Add(this.MidpointActiveXLabel); this.optionsPanel.Controls.Add(this.LimitActiveXLabel); this.optionsPanel.Controls.Add(this.OffsetActiveXLabel); - this.optionsPanel.Controls.Add(this.CapActiveYLabel); + this.optionsPanel.Controls.Add(this.InCapActiveYLabel); this.optionsPanel.Controls.Add(this.WeightActiveYLabel); this.optionsPanel.Controls.Add(this.WeightActiveXLabel); - this.optionsPanel.Controls.Add(this.CapActiveXLabel); + this.optionsPanel.Controls.Add(this.InCapActiveXLabel); this.optionsPanel.Controls.Add(this.AccelerationActiveLabelX); this.optionsPanel.Controls.Add(this.AccelTypeActiveLabelX); this.optionsPanel.Controls.Add(this.RotationActiveLabel); @@ -331,7 +355,7 @@ namespace grapher this.optionsPanel.Controls.Add(this.MouseLabel); this.optionsPanel.Controls.Add(this.LockXYLabel); this.optionsPanel.Controls.Add(this.sensXYLock); - this.optionsPanel.Controls.Add(this.capBoxY); + this.optionsPanel.Controls.Add(this.inCapBoxY); this.optionsPanel.Controls.Add(this.VertHorzRatioBox); this.optionsPanel.Controls.Add(this.writeButton); this.optionsPanel.Controls.Add(this.offsetLabelX); @@ -343,8 +367,8 @@ namespace grapher this.optionsPanel.Controls.Add(this.weightBoxY); this.optionsPanel.Controls.Add(this.weightLabelX); this.optionsPanel.Controls.Add(this.weightBoxX); - this.optionsPanel.Controls.Add(this.capLabelX); - this.optionsPanel.Controls.Add(this.capBoxX); + this.optionsPanel.Controls.Add(this.inCapLabelX); + this.optionsPanel.Controls.Add(this.inCapBoxX); this.optionsPanel.Controls.Add(this.constantOneLabelX); this.optionsPanel.Controls.Add(this.accelerationBoxX); this.optionsPanel.Controls.Add(this.rotationLabel); @@ -485,7 +509,7 @@ namespace grapher // decayRateLabelX // this.decayRateLabelX.AutoSize = true; - this.decayRateLabelX.Location = new System.Drawing.Point(37, 649); + this.decayRateLabelX.Location = new System.Drawing.Point(35, 649); this.decayRateLabelX.Name = "decayRateLabelX"; this.decayRateLabelX.Size = new System.Drawing.Size(64, 13); this.decayRateLabelX.TabIndex = 180; @@ -1098,14 +1122,14 @@ namespace grapher this.weightLabelY.TabIndex = 134; this.weightLabelY.Text = "Weight"; // - // capLabelY + // inCapLabelY // - this.capLabelY.AutoSize = true; - this.capLabelY.Location = new System.Drawing.Point(263, 196); - this.capLabelY.Name = "capLabelY"; - this.capLabelY.Size = new System.Drawing.Size(26, 13); - this.capLabelY.TabIndex = 133; - this.capLabelY.Text = "Cap"; + this.inCapLabelY.AutoSize = true; + this.inCapLabelY.Location = new System.Drawing.Point(263, 196); + this.inCapLabelY.Name = "inCapLabelY"; + this.inCapLabelY.Size = new System.Drawing.Size(56, 13); + this.inCapLabelY.TabIndex = 133; + this.inCapLabelY.Text = "Cap: Input"; // // constantOneLabelY // @@ -1227,14 +1251,14 @@ namespace grapher this.OffsetActiveXLabel.TabIndex = 125; this.OffsetActiveXLabel.Text = "0"; // - // CapActiveYLabel + // InCapActiveYLabel // - this.CapActiveYLabel.AutoSize = true; - this.CapActiveYLabel.Location = new System.Drawing.Point(414, 196); - this.CapActiveYLabel.Name = "CapActiveYLabel"; - this.CapActiveYLabel.Size = new System.Drawing.Size(13, 13); - this.CapActiveYLabel.TabIndex = 124; - this.CapActiveYLabel.Text = "0"; + this.InCapActiveYLabel.AutoSize = true; + this.InCapActiveYLabel.Location = new System.Drawing.Point(414, 196); + this.InCapActiveYLabel.Name = "InCapActiveYLabel"; + this.InCapActiveYLabel.Size = new System.Drawing.Size(13, 13); + this.InCapActiveYLabel.TabIndex = 124; + this.InCapActiveYLabel.Text = "0"; // // WeightActiveYLabel // @@ -1254,14 +1278,14 @@ namespace grapher this.WeightActiveXLabel.TabIndex = 122; this.WeightActiveXLabel.Text = "0"; // - // CapActiveXLabel + // InCapActiveXLabel // - this.CapActiveXLabel.AutoSize = true; - this.CapActiveXLabel.Location = new System.Drawing.Point(197, 196); - this.CapActiveXLabel.Name = "CapActiveXLabel"; - this.CapActiveXLabel.Size = new System.Drawing.Size(13, 13); - this.CapActiveXLabel.TabIndex = 121; - this.CapActiveXLabel.Text = "0"; + this.InCapActiveXLabel.AutoSize = true; + this.InCapActiveXLabel.Location = new System.Drawing.Point(197, 196); + this.InCapActiveXLabel.Name = "InCapActiveXLabel"; + this.InCapActiveXLabel.Size = new System.Drawing.Size(13, 13); + this.InCapActiveXLabel.TabIndex = 121; + this.InCapActiveXLabel.Text = "0"; // // AccelerationActiveLabelX // @@ -1346,12 +1370,12 @@ namespace grapher this.sensXYLock.TabIndex = 82; this.sensXYLock.UseVisualStyleBackColor = true; // - // capBoxY + // inCapBoxY // - this.capBoxY.Location = new System.Drawing.Point(332, 193); - this.capBoxY.Name = "capBoxY"; - this.capBoxY.Size = new System.Drawing.Size(76, 20); - this.capBoxY.TabIndex = 103; + this.inCapBoxY.Location = new System.Drawing.Point(332, 193); + this.inCapBoxY.Name = "inCapBoxY"; + this.inCapBoxY.Size = new System.Drawing.Size(76, 20); + this.inCapBoxY.TabIndex = 103; // // VertHorzRatioBox // @@ -1445,22 +1469,22 @@ namespace grapher this.weightBoxX.Size = new System.Drawing.Size(76, 20); this.weightBoxX.TabIndex = 90; // - // capLabelX + // inCapLabelX // - this.capLabelX.AutoSize = true; - this.capLabelX.Location = new System.Drawing.Point(37, 196); - this.capLabelX.Name = "capLabelX"; - this.capLabelX.Size = new System.Drawing.Size(26, 13); - this.capLabelX.TabIndex = 94; - this.capLabelX.Text = "Cap"; - this.capLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.inCapLabelX.AutoSize = true; + this.inCapLabelX.Location = new System.Drawing.Point(37, 196); + this.inCapLabelX.Name = "inCapLabelX"; + this.inCapLabelX.Size = new System.Drawing.Size(56, 13); + this.inCapLabelX.TabIndex = 94; + this.inCapLabelX.Text = "Cap: Input"; + this.inCapLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // capBoxX + // inCapBoxX // - this.capBoxX.Location = new System.Drawing.Point(106, 193); - this.capBoxX.Name = "capBoxX"; - this.capBoxX.Size = new System.Drawing.Size(76, 20); - this.capBoxX.TabIndex = 89; + this.inCapBoxX.Location = new System.Drawing.Point(106, 193); + this.inCapBoxX.Name = "inCapBoxX"; + this.inCapBoxX.Size = new System.Drawing.Size(76, 20); + this.inCapBoxX.TabIndex = 89; // // constantOneLabelX // @@ -1887,6 +1911,108 @@ namespace grapher title6.Text = "Sensitivity"; this.AccelerationChart.Titles.Add(title6); // + // CapTypeDropdownX + // + this.CapTypeDropdownX.FormattingEnabled = true; + this.CapTypeDropdownX.Location = new System.Drawing.Point(106, 726); + this.CapTypeDropdownX.Name = "CapTypeDropdownX"; + this.CapTypeDropdownX.Size = new System.Drawing.Size(76, 21); + this.CapTypeDropdownX.TabIndex = 195; + // + // CapTypeDropdownY + // + this.CapTypeDropdownY.FormattingEnabled = true; + this.CapTypeDropdownY.Location = new System.Drawing.Point(332, 725); + this.CapTypeDropdownY.Name = "CapTypeDropdownY"; + this.CapTypeDropdownY.Size = new System.Drawing.Size(76, 21); + this.CapTypeDropdownY.TabIndex = 196; + // + // CapTypeLabelX + // + this.CapTypeLabelX.AutoSize = true; + this.CapTypeLabelX.Location = new System.Drawing.Point(38, 728); + this.CapTypeLabelX.Name = "CapTypeLabelX"; + this.CapTypeLabelX.Size = new System.Drawing.Size(53, 13); + this.CapTypeLabelX.TabIndex = 197; + this.CapTypeLabelX.Text = "Cap Type"; + // + // CapTypeLabelY + // + this.CapTypeLabelY.AutoSize = true; + this.CapTypeLabelY.Location = new System.Drawing.Point(263, 729); + this.CapTypeLabelY.Name = "CapTypeLabelY"; + this.CapTypeLabelY.Size = new System.Drawing.Size(53, 13); + this.CapTypeLabelY.TabIndex = 198; + this.CapTypeLabelY.Text = "Cap Type"; + // + // outCapBoxX + // + this.outCapBoxX.Location = new System.Drawing.Point(106, 754); + this.outCapBoxX.Name = "outCapBoxX"; + this.outCapBoxX.Size = new System.Drawing.Size(76, 20); + this.outCapBoxX.TabIndex = 199; + // + // outCapBoxY + // + this.outCapBoxY.Location = new System.Drawing.Point(332, 754); + this.outCapBoxY.Name = "outCapBoxY"; + this.outCapBoxY.Size = new System.Drawing.Size(76, 20); + this.outCapBoxY.TabIndex = 200; + // + // outCapLabelX + // + this.outCapLabelX.AutoSize = true; + this.outCapLabelX.Location = new System.Drawing.Point(35, 757); + this.outCapLabelX.Name = "outCapLabelX"; + this.outCapLabelX.Size = new System.Drawing.Size(64, 13); + this.outCapLabelX.TabIndex = 201; + this.outCapLabelX.Text = "Cap: Output"; + // + // outCapLabelY + // + this.outCapLabelY.AutoSize = true; + this.outCapLabelY.Location = new System.Drawing.Point(262, 757); + this.outCapLabelY.Name = "outCapLabelY"; + this.outCapLabelY.Size = new System.Drawing.Size(64, 13); + this.outCapLabelY.TabIndex = 202; + this.outCapLabelY.Text = "Cap: Output"; + // + // OutCapActiveXLabel + // + this.OutCapActiveXLabel.AutoSize = true; + this.OutCapActiveXLabel.Location = new System.Drawing.Point(200, 757); + this.OutCapActiveXLabel.Name = "OutCapActiveXLabel"; + this.OutCapActiveXLabel.Size = new System.Drawing.Size(13, 13); + this.OutCapActiveXLabel.TabIndex = 203; + this.OutCapActiveXLabel.Text = "0"; + // + // OutCapActiveYLabel + // + this.OutCapActiveYLabel.AutoSize = true; + this.OutCapActiveYLabel.Location = new System.Drawing.Point(414, 757); + this.OutCapActiveYLabel.Name = "OutCapActiveYLabel"; + this.OutCapActiveYLabel.Size = new System.Drawing.Size(13, 13); + this.OutCapActiveYLabel.TabIndex = 204; + this.OutCapActiveYLabel.Text = "0"; + // + // CapTypeActiveXLabel + // + this.CapTypeActiveXLabel.AutoSize = true; + this.CapTypeActiveXLabel.Location = new System.Drawing.Point(200, 728); + this.CapTypeActiveXLabel.Name = "CapTypeActiveXLabel"; + this.CapTypeActiveXLabel.Size = new System.Drawing.Size(16, 13); + this.CapTypeActiveXLabel.TabIndex = 205; + this.CapTypeActiveXLabel.Text = "In"; + // + // CapTypeActiveYLabel + // + this.CapTypeActiveYLabel.AutoSize = true; + this.CapTypeActiveYLabel.Location = new System.Drawing.Point(415, 732); + this.CapTypeActiveYLabel.Name = "CapTypeActiveYLabel"; + this.CapTypeActiveYLabel.Size = new System.Drawing.Size(16, 13); + this.CapTypeActiveYLabel.TabIndex = 206; + this.CapTypeActiveYLabel.Text = "In"; + // // RawAcceleration // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1938,7 +2064,7 @@ namespace grapher private System.Windows.Forms.Label limitLabelY; private System.Windows.Forms.Label offsetLabelY; private System.Windows.Forms.Label weightLabelY; - private System.Windows.Forms.Label capLabelY; + private System.Windows.Forms.Label inCapLabelY; private System.Windows.Forms.Label constantOneLabelY; private System.Windows.Forms.CheckBox ByComponentXYLock; private System.Windows.Forms.Label MidpointActiveYLabel; @@ -1953,10 +2079,10 @@ namespace grapher private System.Windows.Forms.Label MidpointActiveXLabel; private System.Windows.Forms.Label LimitActiveXLabel; private System.Windows.Forms.Label OffsetActiveXLabel; - private System.Windows.Forms.Label CapActiveYLabel; + private System.Windows.Forms.Label InCapActiveYLabel; private System.Windows.Forms.Label WeightActiveYLabel; private System.Windows.Forms.Label WeightActiveXLabel; - private System.Windows.Forms.Label CapActiveXLabel; + private System.Windows.Forms.Label InCapActiveXLabel; private System.Windows.Forms.Label AccelerationActiveLabelX; private System.Windows.Forms.Label AccelTypeActiveLabelX; private System.Windows.Forms.Label RotationActiveLabel; @@ -1966,7 +2092,7 @@ namespace grapher private System.Windows.Forms.Label MouseLabel; private System.Windows.Forms.Label LockXYLabel; private System.Windows.Forms.CheckBox sensXYLock; - private System.Windows.Forms.TextBox capBoxY; + private System.Windows.Forms.TextBox inCapBoxY; private System.Windows.Forms.TextBox VertHorzRatioBox; private System.Windows.Forms.Button writeButton; private System.Windows.Forms.Label offsetLabelX; @@ -1978,8 +2104,8 @@ namespace grapher private System.Windows.Forms.TextBox weightBoxY; private System.Windows.Forms.Label weightLabelX; private System.Windows.Forms.TextBox weightBoxX; - private System.Windows.Forms.Label capLabelX; - private System.Windows.Forms.TextBox capBoxX; + private System.Windows.Forms.Label inCapLabelX; + private System.Windows.Forms.TextBox inCapBoxX; private System.Windows.Forms.Label constantOneLabelX; private System.Windows.Forms.TextBox accelerationBoxX; private System.Windows.Forms.Label rotationLabel; @@ -2070,6 +2196,18 @@ namespace grapher private System.Windows.Forms.TextBox smoothBoxY; private System.Windows.Forms.TextBox smoothBoxX; private System.Windows.Forms.Label VertHorzRatioLabel; + private System.Windows.Forms.ComboBox CapTypeDropdownY; + private System.Windows.Forms.ComboBox CapTypeDropdownX; + private System.Windows.Forms.Label CapTypeLabelY; + private System.Windows.Forms.Label CapTypeLabelX; + private System.Windows.Forms.Label outCapLabelY; + private System.Windows.Forms.Label outCapLabelX; + private System.Windows.Forms.TextBox outCapBoxY; + private System.Windows.Forms.TextBox outCapBoxX; + private System.Windows.Forms.Label OutCapActiveXLabel; + private System.Windows.Forms.Label OutCapActiveYLabel; + private System.Windows.Forms.Label CapTypeActiveYLabel; + private System.Windows.Forms.Label CapTypeActiveXLabel; } } diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 5f2c90e..9eb50cc 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -50,6 +50,8 @@ namespace grapher accelTypeDropY, XLutApplyDropdown, YLutApplyDropdown, + CapTypeDropdownX, + CapTypeDropdownY, writeButton, toggleButton, showVelocityGainToolStripMenuItem, @@ -66,8 +68,10 @@ namespace grapher rotationBox, weightBoxX, weightBoxY, - capBoxX, - capBoxY, + inCapBoxX, + inCapBoxY, + outCapBoxX, + outCapBoxY, offsetBoxX, offsetBoxY, accelerationBoxX, @@ -110,8 +114,12 @@ namespace grapher rotationLabel, weightLabelX, weightLabelY, - capLabelX, - capLabelY, + inCapLabelX, + inCapLabelY, + outCapLabelX, + outCapLabelY, + CapTypeLabelX, + CapTypeLabelY, offsetLabelX, offsetLabelY, constantOneLabelX, @@ -141,8 +149,12 @@ namespace grapher RotationActiveLabel, WeightActiveXLabel, WeightActiveYLabel, - CapActiveXLabel, - CapActiveYLabel, + InCapActiveXLabel, + InCapActiveYLabel, + OutCapActiveXLabel, + OutCapActiveYLabel, + CapTypeActiveXLabel, + CapTypeActiveYLabel, OffsetActiveXLabel, OffsetActiveYLabel, AccelerationActiveLabelX, @@ -243,6 +255,6 @@ namespace grapher } - #endregion Method - } + #endregion Method + } } diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs index fb8fa02..f8fb9ef 100644 --- a/grapher/Layouts/ClassicLayout.cs +++ b/grapher/Layouts/ClassicLayout.cs @@ -11,12 +11,11 @@ namespace grapher.Layouts Mode = AccelMode.classic; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(true, Acceleration); + ClassicCapLayout = new OptionLayout(true, CapType); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Layouts/DefaultLayout.cs b/grapher/Layouts/DefaultLayout.cs index 29d28f7..951052a 100644 --- a/grapher/Layouts/DefaultLayout.cs +++ b/grapher/Layouts/DefaultLayout.cs @@ -12,12 +12,11 @@ namespace grapher.Layouts LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(true, Acceleration); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(true, DecayRate); GrowthRateLayout = new OptionLayout(true, GrowthRate); SmoothLayout = new OptionLayout(true, Smooth); - ScaleLayout = new OptionLayout(true, Scale); - CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(true, Weight); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(true, Limit); diff --git a/grapher/Layouts/JumpLayout.cs b/grapher/Layouts/JumpLayout.cs index 277297c..550e821 100644 --- a/grapher/Layouts/JumpLayout.cs +++ b/grapher/Layouts/JumpLayout.cs @@ -12,12 +12,11 @@ namespace grapher.Layouts LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(true, Smooth); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(false, Weight); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(false, Limit); diff --git a/grapher/Layouts/LUTLayout.cs b/grapher/Layouts/LUTLayout.cs index 5848adb..2a6e70c 100644 --- a/grapher/Layouts/LUTLayout.cs +++ b/grapher/Layouts/LUTLayout.cs @@ -20,12 +20,11 @@ namespace grapher.Layouts Mode = AccelMode.lut; GainSwitchOptionLayout = new OptionLayout(false, string.Empty); - AccelLayout = new OptionLayout(false, Acceleration); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, Cap); WeightLayout = new OptionLayout(false, Weight); OffsetLayout = new OptionLayout(false, Offset); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index 66260eb..f16be64 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -15,18 +15,18 @@ namespace grapher.Layouts public const string Motivity = "Motivity"; public const string Offset = "Offset"; public const string Cap = "Cap"; + public const string CapType = "Cap Type"; public const string Weight = "Weight"; public const string Smooth = "Smooth"; public const string Gain = "Gain"; public LayoutBase() { - AccelLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); @@ -49,17 +49,15 @@ namespace grapher.Layouts public bool LogarithmicCharts { get; protected set; } - protected OptionLayout AccelLayout { get; set; } - protected OptionLayout DecayRateLayout { get; set; } protected OptionLayout GrowthRateLayout { get; set; } protected OptionLayout SmoothLayout { get; set; } - protected OptionLayout ScaleLayout { get; set; } + protected OptionLayout ClassicCapLayout { get; set; } - protected OptionLayout CapLayout { get; set; } + protected OptionLayout PowerCapLayout { get; set; } protected OptionLayout WeightLayout { get; set; } @@ -88,12 +86,11 @@ namespace grapher.Layouts public void Layout( IOption gainSwitchOption, - IOption accelOption, + IOption classicCapOption, + IOption powerCapOption, IOption decayRateOption, IOption growthRateOption, IOption smoothOption, - IOption scaleOption, - IOption capOption, IOption weightOption, IOption offsetOption, IOption limitOption, @@ -110,12 +107,12 @@ namespace grapher.Layouts foreach (var option in new (OptionLayout, IOption)[] { (GainSwitchOptionLayout, gainSwitchOption), - (AccelLayout, accelOption), + (ClassicCapLayout, classicCapOption), + (PowerCapLayout, powerCapOption), + (GainSwitchOptionLayout, gainSwitchOption), (DecayRateLayout, decayRateOption), (GrowthRateLayout, growthRateOption), (SmoothLayout, smoothOption), - (ScaleLayout, scaleOption), - (CapLayout, capOption), (WeightLayout, weightOption), (OffsetLayout, offsetOption), (LimitLayout, limitOption), @@ -146,12 +143,11 @@ namespace grapher.Layouts public void Layout( IOption gainSwitchOption, - IOption accelOption, + IOption classicCapOption, + IOption powerCapOption, IOption decayRateOption, IOption growthRateOption, IOption smoothOption, - IOption scaleOption, - IOption capOption, IOption weightOption, IOption offsetOption, IOption limitOption, @@ -163,12 +159,11 @@ namespace grapher.Layouts IOption lutApplyOption) { Layout(gainSwitchOption, - accelOption, + classicCapOption, + powerCapOption, decayRateOption, growthRateOption, smoothOption, - scaleOption, - capOption, weightOption, offsetOption, limitOption, @@ -178,7 +173,7 @@ namespace grapher.Layouts lutTextOption, lutPanelOption, lutApplyOption, - accelOption.Top); + gainSwitchOption.Top); } } } diff --git a/grapher/Layouts/LinearLayout.cs b/grapher/Layouts/LinearLayout.cs index 6108a0b..36b0f74 100644 --- a/grapher/Layouts/LinearLayout.cs +++ b/grapher/Layouts/LinearLayout.cs @@ -14,12 +14,11 @@ namespace grapher.Layouts LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(true, Acceleration); + ClassicCapLayout = new OptionLayout(true, CapType); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(false, Weight); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Layouts/MotivityLayout.cs b/grapher/Layouts/MotivityLayout.cs index 5443715..d47926a 100644 --- a/grapher/Layouts/MotivityLayout.cs +++ b/grapher/Layouts/MotivityLayout.cs @@ -17,12 +17,11 @@ namespace grapher.Layouts LogarithmicCharts = true; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(true, GrowthRate); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(true, Motivity); diff --git a/grapher/Layouts/NaturalLayout.cs b/grapher/Layouts/NaturalLayout.cs index 15166cb..d763b3b 100644 --- a/grapher/Layouts/NaturalLayout.cs +++ b/grapher/Layouts/NaturalLayout.cs @@ -12,12 +12,11 @@ namespace grapher.Layouts LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(true, DecayRate); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(true, Limit); diff --git a/grapher/Layouts/OffLayout.cs b/grapher/Layouts/OffLayout.cs index d742ef8..b696988 100644 --- a/grapher/Layouts/OffLayout.cs +++ b/grapher/Layouts/OffLayout.cs @@ -12,12 +12,11 @@ namespace grapher.Layouts LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(false, string.Empty); - AccelLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs index d11480f..a1b7e67 100644 --- a/grapher/Layouts/PowerLayout.cs +++ b/grapher/Layouts/PowerLayout.cs @@ -10,12 +10,11 @@ LogarithmicCharts = false; GainSwitchOptionLayout = new OptionLayout(true, Gain); - AccelLayout = new OptionLayout(false, string.Empty); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(true, CapType); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(true, Scale); - CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(true, Weight); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Layouts/UnsupportedLayout.cs b/grapher/Layouts/UnsupportedLayout.cs index 4a401a4..3cf1d41 100644 --- a/grapher/Layouts/UnsupportedLayout.cs +++ b/grapher/Layouts/UnsupportedLayout.cs @@ -17,12 +17,11 @@ namespace grapher.Layouts Mode = AccelMode.noaccel + 1; GainSwitchOptionLayout = new OptionLayout(false, string.Empty); - AccelLayout = new OptionLayout(false, Acceleration); + ClassicCapLayout = new OptionLayout(false, string.Empty); + PowerCapLayout = new OptionLayout(false, string.Empty); DecayRateLayout = new OptionLayout(false, string.Empty); GrowthRateLayout = new OptionLayout(false, string.Empty); SmoothLayout = new OptionLayout(false, string.Empty); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, Cap); WeightLayout = new OptionLayout(false, Weight); OffsetLayout = new OptionLayout(false, Offset); LimitLayout = new OptionLayout(false, string.Empty); diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 20040fb..156606e 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -2,6 +2,7 @@ using grapher.Models.Devices; using grapher.Models.Mouse; using grapher.Models.Options; +using grapher.Models.Options.Cap; using grapher.Models.Options.Directionality; using grapher.Models.Options.LUT; using grapher.Models.Serialized; @@ -27,6 +28,8 @@ namespace grapher.Models ComboBox accelTypeDropY, ComboBox lutApplyDropdownX, ComboBox lutApplyDropdownY, + ComboBox capTypeDropdownX, + ComboBox capTypeDropdownY, Button writeButton, ButtonBase toggleButton, ToolStripMenuItem showVelocityGainToolStripMenuItem, @@ -43,8 +46,10 @@ namespace grapher.Models TextBox rotationBox, TextBox weightBoxX, TextBox weightBoxY, - TextBox capBoxX, - TextBox capBoxY, + TextBox inCapBoxX, + TextBox inCapBoxY, + TextBox outCapBoxX, + TextBox outCapBoxY, TextBox offsetBoxX, TextBox offsetBoxY, TextBox accelerationBoxX, @@ -87,8 +92,12 @@ namespace grapher.Models Label rotationLabel, Label weightLabelX, Label weightLabelY, - Label capLabelX, - Label capLabelY, + Label inCapLabelX, + Label inCapLabelY, + Label outCapLabelX, + Label outCapLabelY, + Label capTypeLabelX, + Label capTypeLabelY, Label offsetLabelX, Label offsetLabelY, Label constantOneLabelX, @@ -118,8 +127,12 @@ namespace grapher.Models Label rotationActiveLabel, Label weightActiveXLabel, Label weightActiveYLabel, - Label capActiveXLabel, - Label capActiveYLabel, + Label inCapActiveXLabel, + Label inCapActiveYLabel, + Label outCapActiveXLabel, + Label outCapActiveYLabel, + Label capTypeActiveXLabel, + Label capTypeActiveYLabel, Label offsetActiveLabelX, Label offsetActiveLabelY, Label accelerationActiveLabelX, @@ -234,24 +247,6 @@ namespace grapher.Models new ActiveValueLabel(weightActiveYLabel, activeValueTitleY), "Weight"); - var capX = new Option( - capBoxX, - form, - 0, - capLabelX, - 0, - new ActiveValueLabel(capActiveXLabel, activeValueTitleX), - "Cap"); - - var capY = new Option( - capBoxY, - form, - 0, - capLabelY, - optionSetYLeft, - new ActiveValueLabel(capActiveYLabel, activeValueTitleY), - "Cap"); - var offsetX = new Option( offsetBoxX, form, @@ -378,6 +373,76 @@ namespace grapher.Models new ActiveValueLabel(midpointActiveLabelY, activeValueTitleY), optionSetYLeft); + var inCapX = new Option( + inCapBoxX, + form, + 0, + inCapLabelX, + 0, + new ActiveValueLabel(inCapActiveXLabel, activeValueTitleX), + "Cap: Input"); + + var inCapY = new Option( + inCapBoxY, + form, + 0, + inCapLabelY, + optionSetYLeft, + new ActiveValueLabel(inCapActiveYLabel, activeValueTitleY), + "Cap"); + + var outCapX = new Option( + outCapBoxX, + form, + 0, + outCapLabelX, + 0, + new ActiveValueLabel(outCapActiveXLabel, activeValueTitleX), + "Cap: Input"); + + var outCapY = new Option( + outCapBoxY, + form, + 0, + outCapLabelY, + optionSetYLeft, + new ActiveValueLabel(outCapActiveYLabel, activeValueTitleY), + "Cap"); + + var capTypeX = new CapTypeOptions( + capTypeLabelX, + capTypeDropdownX, + new ActiveValueLabel(capTypeActiveXLabel, activeValueTitleX)); + + var capTypeY = new CapTypeOptions( + capTypeLabelY, + capTypeDropdownY, + new ActiveValueLabel(capTypeActiveYLabel, activeValueTitleY)); + + var accelCapOptionsX = new CapOptions( + capTypeX, + inCapX, + outCapX, + accelerationX); + + var accelCapOptionsY = new CapOptions( + capTypeY, + inCapY, + outCapY, + accelerationY); + + var powerCapOptionsX = new CapOptions( + capTypeX, + inCapX, + outCapX, + accelerationX); + + var powerCapOptionsY = new CapOptions( + capTypeY, + inCapY, + outCapY, + accelerationY); + var lpNorm = new Option( new Field(lpNormBox, form, 2), lpNormLabel, @@ -421,12 +486,11 @@ namespace grapher.Models var accelerationOptionsX = new AccelTypeOptions( accelTypeDropX, gainSwitchOptionX, - accelerationX, + accelCapOptionsX, + powerCapOptionsX, decayRateX, growthRateX, smoothX, - scaleX, - capX, weightX, offsetX, limitX, @@ -445,12 +509,11 @@ namespace grapher.Models var accelerationOptionsY = new AccelTypeOptions( accelTypeDropY, gainSwitchOptionY, - accelerationY, + accelCapOptionsY, + powerCapOptionsY, decayRateY, growthRateY, smoothY, - scaleY, - capY, weightY, offsetY, limitY, diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index eab38a1..9086b41 100644 --- a/grapher/Models/Options/AccelTypeOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -1,5 +1,6 @@ using grapher.Layouts; using grapher.Models.Options; +using grapher.Models.Options.Cap; using grapher.Models.Options.LUT; using grapher.Models.Serialized; using System; @@ -29,12 +30,11 @@ namespace grapher public AccelTypeOptions( ComboBox accelDropdown, CheckBoxOption gainSwitch, - Option acceleration, + CapOptions classicCap, + CapOptions powerCap, Option decayRate, Option growthRate, Option smooth, - Option scale, - Option cap, Option weight, Option offset, Option limit, @@ -65,12 +65,11 @@ namespace grapher AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged); GainSwitch = gainSwitch; - Acceleration = acceleration; DecayRate = decayRate; GrowthRate = growthRate; Smooth = smooth; - Scale = scale; - Cap = cap; + ClassicCap = classicCap; + PowerCap = powerCap; Weight = weight; Offset = offset; Limit = limit; @@ -85,7 +84,7 @@ namespace grapher AccelTypeActiveValue.Left = AccelDropdown.Left + AccelDropdown.Width; AccelTypeActiveValue.Height = AccelDropdown.Height; - GainSwitch.Left = Acceleration.Field.Left; + GainSwitch.Left = DecayRate.Field.Left; LutPanel.Left = AccelDropdown.Left; LutPanel.Width = AccelDropdown.Width + AccelTypeActiveValue.Width; @@ -108,17 +107,15 @@ namespace grapher public ActiveValueLabel AccelTypeActiveValue { get; } - public Option Acceleration { get; } - public Option DecayRate { get; } public Option GrowthRate { get; } public Option Smooth { get; } - public Option Scale { get; } + public CapOptions ClassicCap { get; } - public Option Cap { get; } + public CapOptions PowerCap { get; } public Option Weight { get; } @@ -228,12 +225,11 @@ namespace grapher AccelTypeActiveValue.Hide(); GainSwitch.Hide(); - Acceleration.Hide(); DecayRate.Hide(); GrowthRate.Hide(); Smooth.Hide(); - Scale.Hide(); - Cap.Hide(); + ClassicCap.Hide(); + PowerCap.Hide(); Weight.Hide(); Offset.Hide(); Limit.Hide(); @@ -263,13 +259,20 @@ namespace grapher AccelTypeActiveValue.SetValue(AccelerationType.ActiveName); GainSwitch.SetActiveValue(args.gain); Weight.SetActiveValue(args.weight); - Cap.SetActiveValue(args.cap.x); + ClassicCap.SetActiveValues( + args.acceleration, + args.cap.x, + args.cap.y, + args.capMode); + PowerCap.SetActiveValues( + args.scale, + args.cap.x, + args.cap.y, + args.capMode); Offset.SetActiveValue(args.offset); - Acceleration.SetActiveValue(args.acceleration); DecayRate.SetActiveValue(args.decayRate); GrowthRate.SetActiveValue(args.growthRate); Smooth.SetActiveValue(args.smooth); - Scale.SetActiveValue(args.scale); Limit.SetActiveValue((args.mode == AccelMode.motivity) ? args.motivity : args.limit); PowerClassic.SetActiveValue(args.exponentClassic); Exponent.SetActiveValue(args.exponentPower); @@ -286,8 +289,8 @@ namespace grapher AccelDropdown.Text = Constants.AccelDropDownDefaultFullText; } - Left = Acceleration.Left + Constants.DropDownLeftSeparation; - Width = Acceleration.Width - Constants.DropDownLeftSeparation; + Left = DecayRate.Left + Constants.DropDownLeftSeparation; + Width = DecayRate.Width - Constants.DropDownLeftSeparation; LutText.Expand(); HandleLUTOptionsOnResize(); @@ -300,8 +303,8 @@ namespace grapher AccelDropdown.Text = Constants.AccelDropDownDefaultShortText; } - Left = Acceleration.Field.Left; - Width = Acceleration.Field.Width; + Left = DecayRate.Field.Left; + Width = DecayRate.Field.Width; LutText.Shorten(); } @@ -311,13 +314,23 @@ namespace grapher args.mode = AccelerationType.Mode; args.gain = GainSwitch.CheckBox.Checked; - if (Acceleration.Visible) args.acceleration = Acceleration.Field.Data; if (DecayRate.Visible) args.decayRate = DecayRate.Field.Data; if (GrowthRate.Visible) args.growthRate = GrowthRate.Field.Data; if (Smooth.Visible) args.smooth = Smooth.Field.Data; - if (Scale.Visible) args.scale = Scale.Field.Data; - // TODO - make field for output and in_out cap - if (Cap.Visible) args.cap.x = Cap.Field.Data; + if (ClassicCap.Visible) + { + args.acceleration = ClassicCap.Slope.Field.Data; + args.cap.x = ClassicCap.In.Field.Data; + args.cap.y = ClassicCap.Out.Field.Data; + args.capMode = ClassicCap.CapTypeOptions.GetSelectedCapMode(); + } + if (PowerCap.Visible) + { + args.scale = ClassicCap.Slope.Field.Data; + args.cap.x = PowerCap.In.Field.Data; + args.cap.y = PowerCap.Out.Field.Data; + args.capMode = PowerCap.CapTypeOptions.GetSelectedCapMode(); + } if (Limit.Visible) { if (args.mode == AccelMode.motivity) @@ -354,12 +367,11 @@ namespace grapher { AccelTypeActiveValue.Align(); GainSwitch.AlignActiveValues(); - Acceleration.AlignActiveValues(); DecayRate.AlignActiveValues(); GrowthRate.AlignActiveValues(); Smooth.AlignActiveValues(); - Scale.AlignActiveValues(); - Cap.AlignActiveValues(); + ClassicCap.AlignActiveValues(); + PowerCap.AlignActiveValues(); Offset.AlignActiveValues(); Weight.AlignActiveValues(); Limit.AlignActiveValues(); @@ -373,7 +385,7 @@ namespace grapher { LutText.Left = AccelDropdown.Left; LutPanel.Left = GainSwitch.Left - 100; - LutPanel.Width = Acceleration.ActiveValueLabel.CenteringLabel.Right - LutPanel.Left; + LutPanel.Width = DecayRate.ActiveValueLabel.CenteringLabel.Right - LutPanel.Left; LutApply.Left = LutPanel.Left; LutApply.Width = AccelDropdown.Right - LutPanel.Left; } @@ -393,12 +405,11 @@ namespace grapher AccelerationType.Layout( GainSwitch, - Acceleration, + ClassicCap, + PowerCap, DecayRate, GrowthRate, Smooth, - Scale, - Cap, Weight, Offset, Limit, diff --git a/grapher/Models/Options/Cap/CapOptions.cs b/grapher/Models/Options/Cap/CapOptions.cs index 2fe44b0..e959dee 100644 --- a/grapher/Models/Options/Cap/CapOptions.cs +++ b/grapher/Models/Options/Cap/CapOptions.cs @@ -21,6 +21,11 @@ namespace grapher.Models.Options.Cap In = capIn; Out = capOut; Slope = slope; + + ShouldShow = true; + TopElement = Slope; + BottomElement = In; + CapTypeOptions.OptionsDropdown.SelectedIndexChanged += OnCapTypeDropdownSelectedItemChanged; } public CapTypeOptions CapTypeOptions { get; } @@ -45,17 +50,16 @@ namespace grapher.Models.Options.Cap public override int Top { - get => CapTypeOptions.Top; + get => TopElement.Top; set { - CapTypeOptions.Top = value; - Layout(); + Layout(value); } } public override int Height { - get => BottomElement.Top + BottomElement.Height - CapTypeOptions.Top; + get => BottomElement.Top + BottomElement.Height - TopElement.Top; } public override int Width @@ -73,45 +77,100 @@ namespace grapher.Models.Options.Cap public override bool Visible { - get => CapTypeOptions.Visible; + get => ShouldShow; + } + + private bool ShouldShow { get; set; } + + private IOption BottomElement { get; set; } + + private IOption TopElement { get; set; } + + public override void AlignActiveValues() + { + Slope.AlignActiveValues(); + CapTypeOptions.AlignActiveValues(); + In.AlignActiveValues(); + Out.AlignActiveValues(); + } + + public override void Show(string name) + { + ShouldShow = true; + Layout(Top, name); } - private Option BottomElement { get; set; } + public override void Hide() + { + ShouldShow = false; + CapTypeOptions.Hide(); + Slope.Hide(); + In.Hide(); + Out.Hide(); + } - public void Layout() + public void SetActiveValues( + double scale, + double inCap, + double outCap, + ClassicCapMode capMode) { - Layout(CapTypeOptions.Top + CapTypeOptions.Height + Constants.OptionVerticalSeperation); + Slope.SetActiveValue(scale); + In.SetActiveValue(inCap); + Out.SetActiveValue(outCap); + CapTypeOptions.SetActiveValue(capMode); } - private void Layout(int top) + private void Layout(int top, string name = null) { switch (CapTypeOptions.SelectedCapType) { case CapType.Input: - Slope.Show(); - In.Show(); - Out.Hide(); + if (ShouldShow) + { + Slope.Show(); + CapTypeOptions.Show(name); + In.Show(); + Out.Hide(); + } Slope.Top = top; - In.SnapTo(Slope); + CapTypeOptions.SnapTo(Slope); + In.SnapTo(CapTypeOptions); + + TopElement = CapTypeOptions; BottomElement = In; break; case CapType.Output: - Slope.Show(); - In.Hide(); - Out.Show(); + if (ShouldShow) + { + Slope.Show(); + CapTypeOptions.Show(name); + In.Hide(); + Out.Show(); + } Slope.Top = top; - In.SnapTo(Slope); - BottomElement = In; + CapTypeOptions.SnapTo(Slope); + Out.SnapTo(CapTypeOptions); + + TopElement = CapTypeOptions; + BottomElement = Out; break; case CapType.Both: - Slope.Hide(); - In.Show(); - Out.Show(); - - In.Top = top; + if (ShouldShow) + { + CapTypeOptions.Show(name); + Slope.Hide(); + In.Show(); + Out.Show(); + } + + CapTypeOptions.Top = top; + In.SnapTo(CapTypeOptions); Out.SnapTo(In); + + TopElement = In; BottomElement = Out; break; } @@ -119,7 +178,7 @@ namespace grapher.Models.Options.Cap private void OnCapTypeDropdownSelectedItemChanged(object sender, EventArgs e) { - Layout(); + Layout(Top); } private void SetupCapTypeDropdown(ComboBox capTypeDropDown) diff --git a/grapher/Models/Options/Cap/CapTypeOptions.cs b/grapher/Models/Options/Cap/CapTypeOptions.cs index 4ea372b..f0c5617 100644 --- a/grapher/Models/Options/Cap/CapTypeOptions.cs +++ b/grapher/Models/Options/Cap/CapTypeOptions.cs @@ -97,6 +97,17 @@ namespace grapher.Models.Options.Cap } } + public ClassicCapMode GetSelectedCapMode() + { + switch(SelectedCapType) + { + case CapType.Output: return ClassicCapMode.output; + case CapType.Both: return ClassicCapMode.in_out; + case CapType.Input: + default: return ClassicCapMode.input; + } + } + #endregion Properties #region Methods |