summaryrefslogtreecommitdiff
path: root/grapher/Models
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-10-08 02:08:27 -0400
committera1xd <[email protected]>2020-10-08 06:36:50 -0400
commit37d2cb7d3ed25862683ef807712c7d50f71e8493 (patch)
tree3852439d718d36a79ebf8b778e82ee5c06461eeb /grapher/Models
parentadd toggle button + save gui settings on close (diff)
downloadrawaccel-37d2cb7d3ed25862683ef807712c7d50f71e8493.tar.xz
rawaccel-37d2cb7d3ed25862683ef807712c7d50f71e8493.zip
add scroll to charts
Diffstat (limited to 'grapher/Models')
-rw-r--r--grapher/Models/AccelGUI.cs2
-rw-r--r--grapher/Models/Charts/AccelCharts.cs34
-rw-r--r--grapher/Models/Charts/ChartState/ChartState.cs25
-rw-r--r--grapher/Models/Charts/ChartXY.cs38
-rw-r--r--grapher/Models/Options/ApplyOptions.cs7
5 files changed, 15 insertions, 91 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs
index c561b23..50207b2 100644
--- a/grapher/Models/AccelGUI.cs
+++ b/grapher/Models/AccelGUI.cs
@@ -35,6 +35,7 @@ namespace grapher
Settings = settings;
Settings.Startup();
RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
+ AccelForm.DoResize();
DefaultButtonFont = WriteButton.Font;
SmallButtonFont = new Font(WriteButton.Font.Name, WriteButton.Font.Size * 0.666f);
@@ -151,6 +152,7 @@ namespace grapher
public void UpdateShownActiveValues(DriverSettings args)
{
+ AccelForm.ResetAutoScroll();
AccelCharts.ShowActive(args);
ApplyOptions.SetActiveValues(args);
}
diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs
index 9087b30..6247811 100644
--- a/grapher/Models/Charts/AccelCharts.cs
+++ b/grapher/Models/Charts/AccelCharts.cs
@@ -13,7 +13,7 @@ namespace grapher
#region Constructors
public AccelCharts(
- Form form,
+ RawAcceleration form,
ChartXY sensitivityChart,
ChartXY velocityChart,
ChartXY gainChart,
@@ -34,10 +34,6 @@ namespace grapher
EnableLastValue = enableLastMouseMove;
WriteButton = writeButton;
-
- Rectangle screenRectangle = ContainingForm.RectangleToScreen(ContainingForm.ClientRectangle);
- FormBorderHeight = screenRectangle.Top - ContainingForm.Top;
-
EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick);
EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableVelocityGainCheckStateChange);
@@ -52,7 +48,7 @@ namespace grapher
#region Properties
- public Form ContainingForm { get; }
+ public RawAcceleration ContainingForm { get; }
public ToolStripMenuItem EnableVelocityAndGain { get; }
@@ -125,23 +121,9 @@ namespace grapher
{
ChartState = ChartStateManager.DetermineState(driverSettings);
ChartState.Activate();
- UpdateFormWidth();
Bind();
}
- public void SetWidened()
- {
- ChartState.SetWidened();
- UpdateFormWidth();
- //AlignWriteButton();
- }
-
- public void SetNarrowed()
- {
- ChartState.SetNarrowed();
- UpdateFormWidth();
- //AlignWriteButton();
- }
public void Redraw()
{
@@ -176,8 +158,6 @@ namespace grapher
velocityChart.SetTop(sensitivityChart.Height + Constants.ChartSeparationVertical);
gainChart.SetHeight(sensitivityChart.Height);
gainChart.SetTop(velocityChart.Top + velocityChart.Height + Constants.ChartSeparationVertical);
-
- sensitivityChart.Show();
}
private void OnEnableClick(object sender, EventArgs e)
@@ -187,6 +167,7 @@ namespace grapher
private void OnEnableVelocityGainCheckStateChange(object sender, EventArgs e)
{
+ ContainingForm.ResetAutoScroll();
if (EnableVelocityAndGain.Checked)
{
ShowVelocityAndGain();
@@ -207,17 +188,12 @@ namespace grapher
private void ShowVelocityAndGain()
{
- ChartState.ShowVelocityAndGain(ContainingForm, FormBorderHeight);
+ ChartState.ShowVelocityAndGain();
}
private void HideVelocityAndGain()
{
- ChartState.HideVelocityAndGain(ContainingForm, FormBorderHeight);
- }
-
- private void UpdateFormWidth()
- {
- ContainingForm.Width = ChartState.SensitivityChart.Left + ChartState.SensitivityChart.Width;
+ ChartState.HideVelocityAndGain();
}
private void AlignWriteButton()
diff --git a/grapher/Models/Charts/ChartState/ChartState.cs b/grapher/Models/Charts/ChartState/ChartState.cs
index 1898e12..270e212 100644
--- a/grapher/Models/Charts/ChartState/ChartState.cs
+++ b/grapher/Models/Charts/ChartState/ChartState.cs
@@ -68,20 +68,6 @@ namespace grapher.Models.Charts.ChartState
GainChart.DrawLastMovementValue(TwoDotsPerGraph);
}
- public void SetWidened()
- {
- SensitivityChart.SetWidened();
- VelocityChart.SetWidened();
- GainChart.SetWidened();
- }
-
- public void SetNarrowed()
- {
- SensitivityChart.SetNarrowed();
- VelocityChart.SetNarrowed();
- GainChart.SetNarrowed();
- }
-
public void ClearLastValue()
{
SensitivityChart.ClearLastValue();
@@ -89,23 +75,16 @@ namespace grapher.Models.Charts.ChartState
GainChart.ClearLastValue();
}
- public void ShowVelocityAndGain(Form form, int borderHeight)
+ public void ShowVelocityAndGain()
{
VelocityChart.Show();
GainChart.Show();
- form.Height = SensitivityChart.Height +
- Constants.ChartSeparationVertical +
- VelocityChart.Height +
- Constants.ChartSeparationVertical +
- GainChart.Height +
- borderHeight;
}
- public void HideVelocityAndGain(Form form, int borderHeight)
+ public void HideVelocityAndGain()
{
VelocityChart.Hide();
GainChart.Hide();
- form.Height = SensitivityChart.Height + borderHeight;
}
public void SetLogarithmic(bool x, bool y)
diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs
index 27b63b5..98ba059 100644
--- a/grapher/Models/Charts/ChartXY.cs
+++ b/grapher/Models/Charts/ChartXY.cs
@@ -24,9 +24,7 @@ namespace grapher
Combined = false;
SetCombined();
-
- Widened = false;
- SetWidened();
+ Visible = true;
}
#endregion Constructors
@@ -72,11 +70,9 @@ namespace grapher
}
}
- public bool Combined { get; private set; }
-
- public bool Widened { get; private set; }
+ public bool Combined { get; set; }
- public bool Visible { get; private set; }
+ public bool Visible { get; set; }
public string Title { get; }
@@ -273,36 +269,10 @@ 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()
{
+
if (Visible)
{
ChartX.Hide();
diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs
index 71e580d..b8cc9bf 100644
--- a/grapher/Models/Options/ApplyOptions.cs
+++ b/grapher/Models/Options/ApplyOptions.cs
@@ -175,16 +175,14 @@ namespace grapher.Models.Options
{
OptionSetX.SetRegularMode();
OptionSetY.Hide();
- AccelCharts.SetWidened();
- SetActiveTitlesWhole();
+ //SetActiveTitlesWhole();
}
public void ShowByComponentAsOneSet()
{
OptionSetX.SetTitleMode("X = Y");
OptionSetY.Hide();
- AccelCharts.SetWidened();
- SetActiveTitlesByComponents();
+ //SetActiveTitlesByComponents();
}
public void ShowByComponentAsTwoSets()
@@ -192,7 +190,6 @@ namespace grapher.Models.Options
OptionSetX.SetTitleMode("X");
OptionSetY.SetTitleMode("Y");
OptionSetY.Show();
- AccelCharts.SetNarrowed();
}
public void ShowByComponentSet()