diff options
| author | Jacob Palecki <[email protected]> | 2021-01-10 23:49:28 -0800 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-01-10 23:49:28 -0800 |
| commit | de6b18db8226650cee9726c4694931bdc4b89fad (patch) | |
| tree | c5bffd4d1eaad53842394c92d4907acb65c6ff84 /grapher | |
| parent | Add to stigma, directional to settings (diff) | |
| download | rawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.tar.xz rawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.zip | |
Implement direcitonality UI
Diffstat (limited to 'grapher')
| -rw-r--r-- | grapher/Constants/Constants.cs | 3 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 296 | ||||
| -rw-r--r-- | grapher/Form1.cs | 25 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 4 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 73 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/ChartStateManager.cs | 4 | ||||
| -rw-r--r-- | grapher/Models/Options/ApplyOptions.cs | 49 | ||||
| -rw-r--r-- | grapher/Models/Options/Directionality/DirectionalityOptions.cs | 172 | ||||
| -rw-r--r-- | grapher/Models/Options/Option.cs | 10 | ||||
| -rw-r--r-- | grapher/Models/Options/OptionXY.cs | 12 | ||||
| -rw-r--r-- | grapher/grapher.csproj | 1 |
11 files changed, 578 insertions, 71 deletions
diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index 5bee626..69b0bbb 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -61,6 +61,9 @@ namespace grapher /// <summary> Vertical placement of write button above bottom of sensitivity graph </summary> public const int ButtonVerticalOffset = 60; + /// <summary> Padding between directionality title and containing panel </summary> + public const int DirectionalityTitlePad = 2; + public const float SmallButtonSizeFactor = 0.666f; /// <summary> Format string for shortened x and y textboxes. </summary> diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 6fd9478..6e1bc3d 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -71,6 +71,20 @@ namespace grapher System.Windows.Forms.DataVisualization.Charting.Title title6 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RawAcceleration)); this.optionsPanel = new System.Windows.Forms.Panel(); + this.DirectionalityPanel = new System.Windows.Forms.Panel(); + this.ByComponentCheckBox = new System.Windows.Forms.CheckBox(); + this.WholeCheckBox = new System.Windows.Forms.CheckBox(); + this.DirectionalityRangeLabel = new System.Windows.Forms.Label(); + this.DirectionalDomainLabel = new System.Windows.Forms.Label(); + this.LpNormBox = new System.Windows.Forms.TextBox(); + this.LPNormLabel = new System.Windows.Forms.Label(); + this.DirectionalityY = new System.Windows.Forms.Label(); + this.DirectionalityX = new System.Windows.Forms.Label(); + this.RangeBoxY = new System.Windows.Forms.TextBox(); + this.RangeBoxX = new System.Windows.Forms.TextBox(); + this.DomainBoxY = new System.Windows.Forms.TextBox(); + this.DomainBoxX = new System.Windows.Forms.TextBox(); + this.DirectionalityLabel = new System.Windows.Forms.Label(); this.toggleButton = new System.Windows.Forms.CheckBox(); this.scaleLabelY = new System.Windows.Forms.Label(); this.ScaleActiveYLabel = new System.Windows.Forms.Label(); @@ -158,9 +172,7 @@ namespace grapher this.offsetStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.gainOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.legacyOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.wholeVectorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.byVectorComponentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AutoWriteMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.chartsPanel = new System.Windows.Forms.Panel(); this.GainChartY = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.VelocityChartY = new System.Windows.Forms.DataVisualization.Charting.Chart(); @@ -168,8 +180,15 @@ 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.AutoWriteMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.DirectionalityActiveValueTitle = new System.Windows.Forms.Label(); + this.DomainActiveValueX = new System.Windows.Forms.Label(); + this.DomainActiveValueY = new System.Windows.Forms.Label(); + this.RangeActiveValueX = new System.Windows.Forms.Label(); + this.RangeActiveValueY = new System.Windows.Forms.Label(); + this.LpNormActiveValue = new System.Windows.Forms.Label(); + this.FakeBox = new System.Windows.Forms.CheckBox(); this.optionsPanel.SuspendLayout(); + this.DirectionalityPanel.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.chartsPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.GainChartY)).BeginInit(); @@ -183,6 +202,8 @@ namespace grapher // optionsPanel // this.optionsPanel.AutoSize = true; + this.optionsPanel.Controls.Add(this.FakeBox); + this.optionsPanel.Controls.Add(this.DirectionalityPanel); this.optionsPanel.Controls.Add(this.toggleButton); this.optionsPanel.Controls.Add(this.scaleLabelY); this.optionsPanel.Controls.Add(this.ScaleActiveYLabel); @@ -262,9 +283,145 @@ namespace grapher this.optionsPanel.TabIndex = 34; this.optionsPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.optionsPanel_Paint); // + // DirectionalityPanel + // + this.DirectionalityPanel.Controls.Add(this.LpNormActiveValue); + this.DirectionalityPanel.Controls.Add(this.RangeActiveValueY); + this.DirectionalityPanel.Controls.Add(this.RangeActiveValueX); + this.DirectionalityPanel.Controls.Add(this.DomainActiveValueY); + this.DirectionalityPanel.Controls.Add(this.DomainActiveValueX); + this.DirectionalityPanel.Controls.Add(this.DirectionalityActiveValueTitle); + this.DirectionalityPanel.Controls.Add(this.ByComponentCheckBox); + this.DirectionalityPanel.Controls.Add(this.WholeCheckBox); + this.DirectionalityPanel.Controls.Add(this.DirectionalityRangeLabel); + this.DirectionalityPanel.Controls.Add(this.DirectionalDomainLabel); + this.DirectionalityPanel.Controls.Add(this.LpNormBox); + this.DirectionalityPanel.Controls.Add(this.LPNormLabel); + this.DirectionalityPanel.Controls.Add(this.DirectionalityY); + this.DirectionalityPanel.Controls.Add(this.DirectionalityX); + this.DirectionalityPanel.Controls.Add(this.RangeBoxY); + this.DirectionalityPanel.Controls.Add(this.RangeBoxX); + this.DirectionalityPanel.Controls.Add(this.DomainBoxY); + this.DirectionalityPanel.Controls.Add(this.DomainBoxX); + this.DirectionalityPanel.Controls.Add(this.DirectionalityLabel); + this.DirectionalityPanel.Location = new System.Drawing.Point(28, 369); + this.DirectionalityPanel.Name = "DirectionalityPanel"; + this.DirectionalityPanel.Size = new System.Drawing.Size(301, 126); + this.DirectionalityPanel.TabIndex = 150; + // + // ByComponentCheckBox + // + this.ByComponentCheckBox.AutoSize = true; + this.ByComponentCheckBox.Location = new System.Drawing.Point(163, 104); + this.ByComponentCheckBox.Name = "ByComponentCheckBox"; + this.ByComponentCheckBox.Size = new System.Drawing.Size(95, 17); + this.ByComponentCheckBox.TabIndex = 12; + this.ByComponentCheckBox.Text = "By Component"; + this.ByComponentCheckBox.UseVisualStyleBackColor = true; + // + // WholeCheckBox + // + this.WholeCheckBox.AutoSize = true; + this.WholeCheckBox.Location = new System.Drawing.Point(43, 104); + this.WholeCheckBox.Name = "WholeCheckBox"; + this.WholeCheckBox.Size = new System.Drawing.Size(57, 17); + this.WholeCheckBox.TabIndex = 11; + this.WholeCheckBox.Text = "Whole"; + this.WholeCheckBox.UseVisualStyleBackColor = true; + // + // DirectionalityRangeLabel + // + this.DirectionalityRangeLabel.AutoSize = true; + this.DirectionalityRangeLabel.Location = new System.Drawing.Point(9, 55); + this.DirectionalityRangeLabel.Name = "DirectionalityRangeLabel"; + this.DirectionalityRangeLabel.Size = new System.Drawing.Size(39, 13); + this.DirectionalityRangeLabel.TabIndex = 10; + this.DirectionalityRangeLabel.Text = "Range"; + // + // DirectionalDomainLabel + // + this.DirectionalDomainLabel.AutoSize = true; + this.DirectionalDomainLabel.Location = new System.Drawing.Point(9, 28); + this.DirectionalDomainLabel.Name = "DirectionalDomainLabel"; + this.DirectionalDomainLabel.Size = new System.Drawing.Size(43, 13); + this.DirectionalDomainLabel.TabIndex = 9; + this.DirectionalDomainLabel.Text = "Domain"; + // + // LpNormBox + // + this.LpNormBox.Location = new System.Drawing.Point(78, 78); + this.LpNormBox.Name = "LpNormBox"; + this.LpNormBox.Size = new System.Drawing.Size(76, 20); + this.LpNormBox.TabIndex = 8; + // + // LPNormLabel + // + this.LPNormLabel.AutoSize = true; + this.LPNormLabel.Location = new System.Drawing.Point(9, 81); + this.LPNormLabel.Name = "LPNormLabel"; + this.LPNormLabel.Size = new System.Drawing.Size(47, 13); + this.LPNormLabel.TabIndex = 7; + this.LPNormLabel.Text = "Lp Norm"; + // + // DirectionalityY + // + this.DirectionalityY.AutoSize = true; + this.DirectionalityY.Location = new System.Drawing.Point(129, 9); + this.DirectionalityY.Name = "DirectionalityY"; + this.DirectionalityY.Size = new System.Drawing.Size(14, 13); + this.DirectionalityY.TabIndex = 6; + this.DirectionalityY.Text = "Y"; + // + // DirectionalityX + // + this.DirectionalityX.AutoSize = true; + this.DirectionalityX.Location = new System.Drawing.Point(86, 9); + this.DirectionalityX.Name = "DirectionalityX"; + this.DirectionalityX.Size = new System.Drawing.Size(14, 13); + this.DirectionalityX.TabIndex = 5; + this.DirectionalityX.Text = "X"; + // + // RangeBoxY + // + this.RangeBoxY.Location = new System.Drawing.Point(120, 52); + this.RangeBoxY.Name = "RangeBoxY"; + this.RangeBoxY.Size = new System.Drawing.Size(34, 20); + this.RangeBoxY.TabIndex = 4; + // + // RangeBoxX + // + this.RangeBoxX.Location = new System.Drawing.Point(78, 52); + this.RangeBoxX.Name = "RangeBoxX"; + this.RangeBoxX.Size = new System.Drawing.Size(34, 20); + this.RangeBoxX.TabIndex = 3; + // + // DomainBoxY + // + this.DomainBoxY.Location = new System.Drawing.Point(120, 25); + this.DomainBoxY.Name = "DomainBoxY"; + this.DomainBoxY.Size = new System.Drawing.Size(34, 20); + this.DomainBoxY.TabIndex = 2; + // + // DomainBoxX + // + this.DomainBoxX.Location = new System.Drawing.Point(78, 25); + this.DomainBoxX.Name = "DomainBoxX"; + this.DomainBoxX.Size = new System.Drawing.Size(34, 20); + this.DomainBoxX.TabIndex = 1; + // + // DirectionalityLabel + // + this.DirectionalityLabel.AutoSize = true; + this.DirectionalityLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.DirectionalityLabel.Location = new System.Drawing.Point(3, 9); + this.DirectionalityLabel.Name = "DirectionalityLabel"; + this.DirectionalityLabel.Size = new System.Drawing.Size(67, 13); + this.DirectionalityLabel.TabIndex = 0; + this.DirectionalityLabel.Text = "Directionality"; + // // toggleButton // - this.toggleButton.Location = new System.Drawing.Point(214, 387); + this.toggleButton.Location = new System.Drawing.Point(211, 534); this.toggleButton.Name = "toggleButton"; this.toggleButton.Size = new System.Drawing.Size(104, 24); this.toggleButton.TabIndex = 112; @@ -710,7 +867,7 @@ namespace grapher // writeButton // this.writeButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); - this.writeButton.Location = new System.Drawing.Point(94, 380); + this.writeButton.Location = new System.Drawing.Point(90, 527); this.writeButton.Name = "writeButton"; this.writeButton.Size = new System.Drawing.Size(92, 35); this.writeButton.TabIndex = 111; @@ -955,7 +1112,6 @@ namespace grapher this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.capStyleToolStripMenuItem, this.offsetStyleToolStripMenuItem, - this.toolStripMenuItem1, this.AutoWriteMenuItem}); this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem"; this.advancedToolStripMenuItem.Size = new System.Drawing.Size(72, 20); @@ -1005,29 +1161,14 @@ namespace grapher this.legacyOffsetToolStripMenuItem.Size = new System.Drawing.Size(147, 22); this.legacyOffsetToolStripMenuItem.Text = "Legacy"; // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.wholeVectorToolStripMenuItem, - this.byVectorComponentToolStripMenuItem}); - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(210, 22); - this.toolStripMenuItem1.Text = "Application Style"; - // - // wholeVectorToolStripMenuItem - // - this.wholeVectorToolStripMenuItem.Checked = true; - this.wholeVectorToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.wholeVectorToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.wholeVectorToolStripMenuItem.Name = "wholeVectorToolStripMenuItem"; - this.wholeVectorToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.wholeVectorToolStripMenuItem.Text = "Whole"; - // - // byVectorComponentToolStripMenuItem + // AutoWriteMenuItem // - this.byVectorComponentToolStripMenuItem.Name = "byVectorComponentToolStripMenuItem"; - this.byVectorComponentToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.byVectorComponentToolStripMenuItem.Text = "By Component"; + this.AutoWriteMenuItem.Checked = true; + this.AutoWriteMenuItem.CheckOnClick = true; + this.AutoWriteMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.AutoWriteMenuItem.Name = "AutoWriteMenuItem"; + this.AutoWriteMenuItem.Size = new System.Drawing.Size(210, 22); + this.AutoWriteMenuItem.Text = "Apply Settings On Startup"; // // chartsPanel // @@ -1281,14 +1422,69 @@ namespace grapher title6.Text = "Sensitivity"; this.AccelerationChart.Titles.Add(title6); // - // AutoWriteMenuItem - // - this.AutoWriteMenuItem.Checked = true; - this.AutoWriteMenuItem.CheckOnClick = true; - this.AutoWriteMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.AutoWriteMenuItem.Name = "AutoWriteMenuItem"; - this.AutoWriteMenuItem.Size = new System.Drawing.Size(210, 22); - this.AutoWriteMenuItem.Text = "Apply Settings On Startup"; + // DirectionalityActiveValueTitle + // + this.DirectionalityActiveValueTitle.AutoSize = true; + this.DirectionalityActiveValueTitle.Location = new System.Drawing.Point(169, 9); + this.DirectionalityActiveValueTitle.Name = "DirectionalityActiveValueTitle"; + this.DirectionalityActiveValueTitle.Size = new System.Drawing.Size(41, 13); + this.DirectionalityActiveValueTitle.TabIndex = 13; + this.DirectionalityActiveValueTitle.Text = "Current"; + // + // DomainActiveValueX + // + this.DomainActiveValueX.AutoSize = true; + this.DomainActiveValueX.Location = new System.Drawing.Point(169, 28); + this.DomainActiveValueX.Name = "DomainActiveValueX"; + this.DomainActiveValueX.Size = new System.Drawing.Size(13, 13); + this.DomainActiveValueX.TabIndex = 14; + this.DomainActiveValueX.Text = "0"; + // + // DomainActiveValueY + // + this.DomainActiveValueY.AutoSize = true; + this.DomainActiveValueY.Location = new System.Drawing.Point(189, 28); + this.DomainActiveValueY.Name = "DomainActiveValueY"; + this.DomainActiveValueY.Size = new System.Drawing.Size(13, 13); + this.DomainActiveValueY.TabIndex = 15; + this.DomainActiveValueY.Text = "0"; + // + // RangeActiveValueX + // + this.RangeActiveValueX.AutoSize = true; + this.RangeActiveValueX.Location = new System.Drawing.Point(169, 55); + this.RangeActiveValueX.Name = "RangeActiveValueX"; + this.RangeActiveValueX.Size = new System.Drawing.Size(13, 13); + this.RangeActiveValueX.TabIndex = 16; + this.RangeActiveValueX.Text = "0"; + // + // RangeActiveValueY + // + this.RangeActiveValueY.AutoSize = true; + this.RangeActiveValueY.Location = new System.Drawing.Point(188, 55); + this.RangeActiveValueY.Name = "RangeActiveValueY"; + this.RangeActiveValueY.Size = new System.Drawing.Size(13, 13); + this.RangeActiveValueY.TabIndex = 17; + this.RangeActiveValueY.Text = "0"; + // + // LpNormActiveValue + // + this.LpNormActiveValue.AutoSize = true; + this.LpNormActiveValue.Location = new System.Drawing.Point(180, 78); + this.LpNormActiveValue.Name = "LpNormActiveValue"; + this.LpNormActiveValue.Size = new System.Drawing.Size(13, 13); + this.LpNormActiveValue.TabIndex = 18; + this.LpNormActiveValue.Text = "0"; + // + // FakeBox + // + this.FakeBox.AutoSize = true; + this.FakeBox.Location = new System.Drawing.Point(28, 502); + this.FakeBox.Name = "FakeBox"; + this.FakeBox.Size = new System.Drawing.Size(47, 17); + this.FakeBox.TabIndex = 151; + this.FakeBox.Text = "fake"; + this.FakeBox.UseVisualStyleBackColor = true; // // RawAcceleration // @@ -1304,6 +1500,8 @@ namespace grapher this.Paint += new System.Windows.Forms.PaintEventHandler(this.RawAcceleration_Paint); this.optionsPanel.ResumeLayout(false); this.optionsPanel.PerformLayout(); + this.DirectionalityPanel.ResumeLayout(false); + this.DirectionalityPanel.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.chartsPanel.ResumeLayout(false); @@ -1407,9 +1605,6 @@ namespace grapher private System.Windows.Forms.ToolStripMenuItem offsetStyleToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem gainOffsetToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem legacyOffsetToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem wholeVectorToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem byVectorComponentToolStripMenuItem; private System.Windows.Forms.Panel chartsPanel; private System.Windows.Forms.DataVisualization.Charting.Chart GainChartY; private System.Windows.Forms.DataVisualization.Charting.Chart VelocityChartY; @@ -1418,6 +1613,27 @@ namespace grapher private System.Windows.Forms.DataVisualization.Charting.Chart VelocityChart; private System.Windows.Forms.DataVisualization.Charting.Chart AccelerationChart; private System.Windows.Forms.ToolStripMenuItem AutoWriteMenuItem; + private System.Windows.Forms.Panel DirectionalityPanel; + private System.Windows.Forms.Label DirectionalityRangeLabel; + private System.Windows.Forms.Label DirectionalDomainLabel; + private System.Windows.Forms.TextBox LpNormBox; + private System.Windows.Forms.Label LPNormLabel; + private System.Windows.Forms.Label DirectionalityY; + private System.Windows.Forms.Label DirectionalityX; + private System.Windows.Forms.TextBox RangeBoxY; + private System.Windows.Forms.TextBox RangeBoxX; + private System.Windows.Forms.TextBox DomainBoxY; + private System.Windows.Forms.TextBox DomainBoxX; + private System.Windows.Forms.Label DirectionalityLabel; + private System.Windows.Forms.CheckBox ByComponentCheckBox; + private System.Windows.Forms.CheckBox WholeCheckBox; + private System.Windows.Forms.Label DirectionalityActiveValueTitle; + private System.Windows.Forms.Label DomainActiveValueX; + private System.Windows.Forms.Label DomainActiveValueY; + private System.Windows.Forms.Label RangeActiveValueX; + private System.Windows.Forms.Label LpNormActiveValue; + private System.Windows.Forms.Label RangeActiveValueY; + private System.Windows.Forms.CheckBox FakeBox; } } diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 0c12b86..06f76f1 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -64,8 +64,6 @@ namespace grapher toggleButton, showVelocityGainToolStripMenuItem, showLastMouseMoveToolStripMenuItem, - wholeVectorToolStripMenuItem, - byVectorComponentToolStripMenuItem, gainCapToolStripMenuItem, legacyCapToolStripMenuItem, gainOffsetToolStripMenuItem, @@ -74,6 +72,7 @@ namespace grapher ScaleMenuItem, DPITextBox, PollRateTextBox, + DirectionalityPanel, sensitivityBoxX, sensitivityBoxY, rotationBox, @@ -93,8 +92,16 @@ namespace grapher expBoxY, midpointBoxX, midpointBoxY, + DomainBoxX, + DomainBoxY, + RangeBoxX, + RangeBoxY, + LpNormBox, sensXYLock, ByComponentXYLock, + FakeBox, + WholeCheckBox, + ByComponentCheckBox, LockXYLabel, sensitivityLabel, rotationLabel, @@ -139,7 +146,19 @@ namespace grapher AccelTypeActiveLabelY, OptionSetXTitle, OptionSetYTitle, - MouseLabel); + MouseLabel, + DirectionalityLabel, + DirectionalityX, + DirectionalityY, + DirectionalityActiveValueTitle, + LPNormLabel, + LpNormActiveValue, + DirectionalDomainLabel, + DomainActiveValueX, + DomainActiveValueY, + DirectionalityRangeLabel, + RangeActiveValueX, + RangeActiveValueY); } #endregion Constructor diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index c6a2dcc..045cb23 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -141,7 +141,9 @@ namespace grapher modes = ApplyOptions.GetModes(), args = newArgs, minimumTime = driverSettings.minimumTime, - directionalMultipliers = driverSettings.directionalMultipliers + directionalMultipliers = driverSettings.directionalMultipliers, + domainArgs = ApplyOptions.Directionality.GetDomainArgs(), + rangeXY = ApplyOptions.Directionality.GetRangeXY(), }; ButtonDelay(WriteButton); diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 901a1b5..1035cb7 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -1,6 +1,7 @@ using grapher.Models.Calculations; using grapher.Models.Mouse; using grapher.Models.Options; +using grapher.Models.Options.Directionality; using grapher.Models.Serialized; using System; using System.Windows.Forms; @@ -27,8 +28,6 @@ namespace grapher.Models ButtonBase toggleButton, ToolStripMenuItem showVelocityGainToolStripMenuItem, ToolStripMenuItem showLastMouseMoveMenuItem, - ToolStripMenuItem wholeVectorToolStripMenuItem, - ToolStripMenuItem byVectorComponentToolStripMenuItem, ToolStripMenuItem velocityGainCapToolStripMenuItem, ToolStripMenuItem legacyCapToolStripMenuItem, ToolStripMenuItem gainOffsetToolStripMenuItem, @@ -37,6 +36,7 @@ namespace grapher.Models ToolStripMenuItem scaleMenuItem, ToolStripTextBox dpiTextBox, ToolStripTextBox pollRateTextBox, + Panel directionalityPanel, TextBox sensitivityBoxX, TextBox sensitivityBoxY, TextBox rotationBox, @@ -56,8 +56,16 @@ namespace grapher.Models TextBox expBoxY, TextBox midpointBoxX, TextBox midpointBoxY, + TextBox domainBoxX, + TextBox domainBoxY, + TextBox rangeBoxX, + TextBox rangeBoxY, + TextBox lpNormBox, CheckBox sensXYLock, CheckBox byComponentXYLock, + CheckBox fakeBox, + CheckBox wholeCheckBox, + CheckBox byComponentCheckBox, Label lockXYLabel, Label sensitivityLabel, Label rotationLabel, @@ -102,8 +110,23 @@ namespace grapher.Models Label accelTypeActiveLabelY, Label optionSetXTitle, Label optionSetYTitle, - Label mouseLabel) + Label mouseLabel, + Label directionalityLabel, + Label directionalityX, + Label directionalityY, + Label direcionalityActiveValueTitle, + Label lpNormLabel, + Label lpNormActiveLabel, + Label domainLabel, + Label domainActiveValueX, + Label domainActiveValueY, + Label rangeLabel, + Label rangeActiveValueX, + Label rangeActiveValueY) { + fakeBox.Checked = false; + fakeBox.Hide(); + var accelCalculator = new AccelCalculator( new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI, 1), new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate, 1)); @@ -141,6 +164,8 @@ namespace grapher.Models var optionSetYLeft = rotation.Left + rotation.Width; + var directionalityLeft = directionalityPanel.Left; + var weightX = new Option( weightBoxX, form, @@ -265,6 +290,34 @@ namespace grapher.Models new ActiveValueLabel(midpointActiveLabelY, activeValueTitleY), optionSetYLeft); + var lpNorm = new Option( + new Field(lpNormBox, form, 2), + lpNormLabel, + new ActiveValueLabel(lpNormActiveLabel, direcionalityActiveValueTitle), + directionalityLeft); + + var domain = new OptionXY( + domainBoxX, + domainBoxY, + fakeBox, + form, + 1, + domainLabel, + new ActiveValueLabelXY( + new ActiveValueLabel(domainActiveValueX, direcionalityActiveValueTitle), + new ActiveValueLabel(domainActiveValueY, direcionalityActiveValueTitle))); + + var range = new OptionXY( + rangeBoxX, + rangeBoxY, + fakeBox, + form, + 1, + rangeLabel, + new ActiveValueLabelXY( + new ActiveValueLabel(rangeActiveValueX, direcionalityActiveValueTitle), + new ActiveValueLabel(rangeActiveValueY, direcionalityActiveValueTitle))); + var capOptionsX = new CapOptions( velocityGainCapToolStripMenuItem, legacyCapToolStripMenuItem, @@ -313,12 +366,22 @@ namespace grapher.Models rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation, accelerationOptionsY); + var directionalOptions = new DirectionalityOptions( + directionalityPanel, + directionalityLabel, + directionalityX, + directionalityY, + lpNorm, + domain, + range, + wholeCheckBox, + byComponentCheckBox); + var applyOptions = new ApplyOptions( - wholeVectorToolStripMenuItem, - byVectorComponentToolStripMenuItem, byComponentXYLock, optionsSetX, optionsSetY, + directionalOptions, sensitivity, rotation, lockXYLabel, diff --git a/grapher/Models/Charts/ChartState/ChartStateManager.cs b/grapher/Models/Charts/ChartState/ChartStateManager.cs index 54d2e81..ff4fe54 100644 --- a/grapher/Models/Charts/ChartState/ChartStateManager.cs +++ b/grapher/Models/Charts/ChartState/ChartStateManager.cs @@ -52,7 +52,9 @@ namespace grapher.Models.Charts.ChartState if (settings.combineMagnitudes) { - if (settings.sensitivity.x != settings.sensitivity.y) + if (settings.sensitivity.x != settings.sensitivity.y || + settings.domainArgs.domainXY.x != settings.domainArgs.domainXY.y || + settings.rangeXY.x != settings.rangeXY.y) { chartState = XYOneGraphState; } diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs index b8cc9bf..ffe430d 100644 --- a/grapher/Models/Options/ApplyOptions.cs +++ b/grapher/Models/Options/ApplyOptions.cs @@ -1,4 +1,5 @@ -using grapher.Models.Serialized; +using grapher.Models.Options.Directionality; +using grapher.Models.Serialized; using System; using System.Drawing; using System.Windows.Forms; @@ -10,24 +11,24 @@ namespace grapher.Models.Options #region Constructors public ApplyOptions( - ToolStripMenuItem wholeVectorMenuItem, - ToolStripMenuItem byComponentMenuItem, CheckBox byComponentVectorXYLock, AccelOptionSet optionSetX, AccelOptionSet optionSetY, + DirectionalityOptions directionalityOptions, OptionXY sensitivity, Option rotation, Label lockXYLabel, AccelCharts accelCharts) { - WholeVectorMenuItem = wholeVectorMenuItem; - ByComponentVectorMenuItem = byComponentMenuItem; + Directionality = directionalityOptions; + WholeVectorCheckBox = Directionality.WholeCheckBox; + ByComponentVectorCheckBox = Directionality.ByComponentCheckBox; - WholeVectorMenuItem.Click += new System.EventHandler(OnWholeClicked); - ByComponentVectorMenuItem.Click += new System.EventHandler(OnByComponentClicked); + WholeVectorCheckBox.Click += new System.EventHandler(OnWholeClicked); + ByComponentVectorCheckBox.Click += new System.EventHandler(OnByComponentClicked); - WholeVectorMenuItem.CheckedChanged += new System.EventHandler(OnWholeCheckedChange); - ByComponentVectorMenuItem.CheckedChanged += new System.EventHandler(OnByComponentCheckedChange); + WholeVectorCheckBox.CheckedChanged += new System.EventHandler(OnWholeCheckedChange); + ByComponentVectorCheckBox.CheckedChanged += new System.EventHandler(OnByComponentCheckedChange); ByComponentVectorXYLock = byComponentVectorXYLock; OptionSetX = optionSetX; @@ -52,9 +53,9 @@ namespace grapher.Models.Options #region Properties - public ToolStripMenuItem WholeVectorMenuItem { get; } + public CheckBox WholeVectorCheckBox { get; } - public ToolStripMenuItem ByComponentVectorMenuItem { get; } + public CheckBox ByComponentVectorCheckBox { get; } public CheckBox ByComponentVectorXYLock { get; } @@ -62,6 +63,8 @@ namespace grapher.Models.Options public AccelOptionSet OptionSetY { get; } + public DirectionalityOptions Directionality { get; } + public OptionXY Sensitivity { get; } public Option Rotation { get; } @@ -114,8 +117,8 @@ namespace grapher.Models.Options Sensitivity.SetActiveValues(xSens, ySens); Rotation.SetActiveValue(rotation); OptionSetX.SetActiveValues(xMode, xArgs); - WholeVectorMenuItem.Checked = isWhole; - ByComponentVectorMenuItem.Checked = !isWhole; + WholeVectorCheckBox.Checked = isWhole; + ByComponentVectorCheckBox.Checked = !isWhole; ByComponentVectorXYLock.Checked = xArgs.Equals(yArgs); OptionSetY.SetActiveValues(yMode, yArgs); } @@ -132,6 +135,8 @@ namespace grapher.Models.Options settings.args.y, settings.combineMagnitudes); + Directionality.SetActiveValues(settings); + AccelCharts.SetLogarithmic( OptionSetX.Options.AccelerationType.LogarithmicCharts, OptionSetY.Options.AccelerationType.LogarithmicCharts); @@ -139,25 +144,27 @@ namespace grapher.Models.Options public void OnWholeClicked(object sender, EventArgs e) { - if (!WholeVectorMenuItem.Checked) + if (!WholeVectorCheckBox.Checked) { - WholeVectorMenuItem.Checked = true; - ByComponentVectorMenuItem.Checked = false; + WholeVectorCheckBox.Checked = true; + ByComponentVectorCheckBox.Checked = false; + Directionality.ToWhole(); } } public void OnByComponentClicked(object sender, EventArgs e) { - if (!ByComponentVectorMenuItem.Checked) + if (!ByComponentVectorCheckBox.Checked) { - WholeVectorMenuItem.Checked = false; - ByComponentVectorMenuItem.Checked = true; + WholeVectorCheckBox.Checked = false; + ByComponentVectorCheckBox.Checked = true; + Directionality.ToByComponent(); } } public void OnWholeCheckedChange(object sender, EventArgs e) { - if (WholeVectorMenuItem.Checked) + if (WholeVectorCheckBox.Checked) { EnableWholeApplication(); } @@ -165,7 +172,7 @@ namespace grapher.Models.Options public void OnByComponentCheckedChange(object sender, EventArgs e) { - if (ByComponentVectorMenuItem.Checked) + if (ByComponentVectorCheckBox.Checked) { EnableByComponentApplication(); } diff --git a/grapher/Models/Options/Directionality/DirectionalityOptions.cs b/grapher/Models/Options/Directionality/DirectionalityOptions.cs new file mode 100644 index 0000000..3de93b4 --- /dev/null +++ b/grapher/Models/Options/Directionality/DirectionalityOptions.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Models.Options.Directionality +{ + public class DirectionalityOptions + { + public DirectionalityOptions( + Panel containingPanel, + Label directionalityLabel, + Label directionalityX, + Label directionalityY, + Option lpNorm, + OptionXY domain, + OptionXY range, + CheckBox wholeCheckBox, + CheckBox byComponentCheckBox) + { + ContainingPanel = containingPanel; + DirectionalityLabel = directionalityLabel; + DirectionalityX = directionalityX; + DirectionalityY = directionalityY; + LpNorm = lpNorm; + Domain = domain; + Range = range; + WholeCheckBox = wholeCheckBox; + ByComponentCheckBox = byComponentCheckBox; + + ContainingPanel.Paint += panel_Paint; + DirectionalityLabel.Left = ContainingPanel.Left + Constants.DirectionalityTitlePad; + DirectionalityLabel.Top = ContainingPanel.Top + Constants.DirectionalityTitlePad; + ToWhole(); + Hide(); + } + + public Panel ContainingPanel { get; } + + public Label DirectionalityLabel { get; } + + public Label DirectionalityX { get; } + + public Label DirectionalityY { get; } + + public Option LpNorm { get; } + + public OptionXY Domain { get; } + + public OptionXY Range { get; } + + public CheckBox WholeCheckBox { get; } + + public CheckBox ByComponentCheckBox { get; } + + public DomainArgs GetDomainArgs() + { + if (!ByComponentCheckBox.Checked) + { + return new DomainArgs + { + domainXY = new Vec2<double> + { + x = Domain.Fields.X, + y = Domain.Fields.Y, + }, + lpNorm = LpNorm.Field.Data, + }; + } + else + { + return new DomainArgs + { + domainXY = new Vec2<double> + { + x = 1, + y = 1, + }, + lpNorm = 2, + }; + + } + } + + public Vec2<double> GetRangeXY() + { + if (!ByComponentCheckBox.Checked) + { + return new Vec2<double> + { + x = Range.Fields.X, + y = Range.Fields.Y, + }; + } + else + { + return new Vec2<double> + { + x = 1, + y = 1, + }; + } + + } + + public void SetActiveValues(DriverSettings settings) + { + Domain.SetActiveValues(settings.domainArgs.domainXY.x, settings.domainArgs.domainXY.y); + LpNorm.SetActiveValue(settings.domainArgs.lpNorm); + Range.SetActiveValues(settings.rangeXY.x, settings.rangeXY.y); + } + + public void Hide() + { + DirectionalityX.Hide(); + DirectionalityY.Hide(); + LpNorm.Hide(); + Domain.Hide(); + Range.Hide(); + WholeCheckBox.Hide(); + ByComponentCheckBox.Hide(); + DrawHidden(); + } + + public void ToByComponent() + { + LpNorm.SetToUnavailable(); + Domain.SetToUnavailable(); + Range.SetToUnavailable(); + } + + public void ToWhole() + { + LpNorm.SetToAvailable(); + Domain.SetToAvailable(); + Range.SetToAvailable(); + } + + public void Show() + { + DirectionalityX.Hide(); + DirectionalityY.Hide(); + LpNorm.Hide(); + Domain.Hide(); + Range.Hide(); + WholeCheckBox.Hide(); + ByComponentCheckBox.Hide(); + DrawShown(); + } + + private void DrawHidden() + { + ContainingPanel.Height = DirectionalityLabel.Height + 2 * Constants.DirectionalityTitlePad; + } + + private void DrawShown() + { + ContainingPanel.Height = WholeCheckBox.Bottom - DirectionalityLabel.Top + 2 * Constants.DirectionalityTitlePad; + } + + private void panel_Paint(object sender, PaintEventArgs e) + { + Color col = Color.DarkGray; + ButtonBorderStyle bbs = ButtonBorderStyle.Dashed; + int thickness = 2; + ControlPaint.DrawBorder(e.Graphics, this.ContainingPanel.ClientRectangle, col, thickness, bbs, col, thickness, bbs, col, thickness, bbs, col, thickness, bbs); + } + } +} diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index d5129d5..c6b68ba 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -171,6 +171,16 @@ namespace grapher ActiveValueLabel.Align(); } + public void SetToUnavailable() + { + Field.SetToUnavailable(); + } + + public void SetToAvailable() + { + Field.SetToDefault(); + } + #endregion Methods } } diff --git a/grapher/Models/Options/OptionXY.cs b/grapher/Models/Options/OptionXY.cs index b4a2b27..3557a06 100644 --- a/grapher/Models/Options/OptionXY.cs +++ b/grapher/Models/Options/OptionXY.cs @@ -153,6 +153,18 @@ namespace grapher Show(); } + public void SetToUnavailable() + { + Fields.XField.SetToUnavailable(); + Fields.YField.SetToUnavailable(); + } + + public void SetToAvailable() + { + Fields.XField.SetToDefault(); + Fields.YField.SetToDefault(); + } + #endregion Methods } } diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj index f6bdcb9..140d521 100644 --- a/grapher/grapher.csproj +++ b/grapher/grapher.csproj @@ -117,6 +117,7 @@ <Compile Include="Layouts\NaturalLayout.cs" /> <Compile Include="Layouts\OffLayout.cs" /> <Compile Include="Layouts\PowerLayout.cs" /> + <Compile Include="Models\Options\Directionality\DirectionalityOptions.cs" /> <Compile Include="Models\Options\IOption.cs" /> <Compile Include="Models\Options\OffsetOptions.cs" /> <Compile Include="Models\Options\Option.cs" /> |