diff options
| author | Jacob Palecki <[email protected]> | 2020-09-07 20:30:15 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-07 20:30:15 -0700 |
| commit | 1462da675f1bc36d2a770413f13ccc68165cf1e9 (patch) | |
| tree | b2636b1455668b42121ffb1133034ed2b30ce672 /grapher/Models | |
| parent | Fix some separation bugs (diff) | |
| download | rawaccel-1462da675f1bc36d2a770413f13ccc68165cf1e9.tar.xz rawaccel-1462da675f1bc36d2a770413f13ccc68165cf1e9.zip | |
Add chart resize
Diffstat (limited to 'grapher/Models')
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 3 | ||||
| -rw-r--r-- | grapher/Models/Charts/AccelCharts.cs | 16 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 33 | ||||
| -rw-r--r-- | grapher/Models/Options/ApplyOptions.cs | 9 | ||||
| -rw-r--r-- | grapher/Models/Options/Option.cs | 1 |
5 files changed, 59 insertions, 3 deletions
diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 5d52f2e..7dbf200 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -268,7 +268,8 @@ namespace grapher.Models byVectorComponentToolStripMenuItem, byComponentXYLock, optionsSetX, - optionsSetY); + optionsSetY, + accelCharts); var accelCalculator = new AccelCalculator( new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI), diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 5e4b3de..6d9f0a1 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -132,6 +132,22 @@ namespace grapher } } + public void SetWidened() + { + SensitivityChart.SetWidened(); + VelocityChart.SetWidened(); + GainChart.SetWidened(); + UpdateFormWidth(); + } + + public void SetNarrowed() + { + SensitivityChart.SetNarrowed(); + VelocityChart.SetNarrowed(); + GainChart.SetNarrowed(); + UpdateFormWidth(); + } + private void OnEnableClick(object sender, EventArgs e) { EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked; diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 6a65e41..7998f7f 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -29,6 +29,9 @@ namespace grapher SetupChart(ChartX); SetupChart(ChartY); + + Widened = false; + SetWidened(); } #endregion Constructors @@ -76,6 +79,8 @@ namespace grapher public bool Combined { get; private set; } + public bool Widened { get; private set; } + private PointData CombinedPointData { get; set; } private PointData XPointData { get; set; } @@ -174,6 +179,34 @@ namespace grapher } } + public void SetWidened() + { + if (!Widened) + { + ChartX.Width = Constants.WideChartWidth; + ChartY.Width = Constants.WideChartWidth; + + ChartX.Left = Constants.WideChartLeft; + ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal; + + Widened = true; + } + } + + public void SetNarrowed() + { + if (Widened) + { + ChartX.Width = Constants.NarrowChartWidth; + ChartY.Width = Constants.NarrowChartWidth; + + ChartX.Left = Constants.NarrowChartLeft; + ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal; + + Widened = false; + } + } + public void Hide() { ChartX.Hide(); diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs index 68f06fb..96d598d 100644 --- a/grapher/Models/Options/ApplyOptions.cs +++ b/grapher/Models/Options/ApplyOptions.cs @@ -18,7 +18,8 @@ namespace grapher.Models.Options ToolStripMenuItem byComponentMenuItem, CheckBox byComponentVectorXYLock, AccelOptionSet optionSetX, - AccelOptionSet optionSetY) + AccelOptionSet optionSetY, + AccelCharts accelCharts) { WholeVectorMenuItem = wholeVectorMenuItem; ByComponentVectorMenuItem = byComponentMenuItem; @@ -32,6 +33,7 @@ namespace grapher.Models.Options ByComponentVectorXYLock = byComponentVectorXYLock; OptionSetX = optionSetX; OptionSetY = optionSetY; + AccelCharts = accelCharts; ByComponentVectorXYLock.CheckedChanged += new System.EventHandler(OnByComponentXYLockChecked); ByComponentVectorXYLock.Checked = true; @@ -53,6 +55,8 @@ namespace grapher.Models.Options public AccelOptionSet OptionSetY { get; } + public AccelCharts AccelCharts { get; } + public bool IsWhole { get; private set; } #endregion Properties @@ -130,12 +134,14 @@ namespace grapher.Models.Options { OptionSetX.SetRegularMode(); OptionSetY.Hide(); + AccelCharts.SetWidened(); } public void ShowByComponentAsOneSet() { OptionSetX.SetTitleMode("X = Y"); OptionSetY.Hide(); + AccelCharts.SetWidened(); } public void ShowByComponentAsTwoSets() @@ -143,6 +149,7 @@ namespace grapher.Models.Options OptionSetX.SetTitleMode("X"); OptionSetY.SetTitleMode("Y"); OptionSetY.Show(); + AccelCharts.SetNarrowed(); } public void ShowByComponentSet() diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 5355a8a..3c7b2ec 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -112,7 +112,6 @@ namespace grapher } set { - Field.Width = value; } } |