summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-26 00:25:06 -0700
committerJacob Palecki <[email protected]>2020-09-26 00:25:06 -0700
commitbcc32f19c53f9c0e422b195db83a3cf87bbd5b37 (patch)
tree3ca874bcdcfcfec51f56b3ec22c981a1d4a91e55
parentSetActive changes field default, bugs fixed (diff)
downloadrawaccel-bcc32f19c53f9c0e422b195db83a3cf87bbd5b37.tar.xz
rawaccel-bcc32f19c53f9c0e422b195db83a3cf87bbd5b37.zip
Show active values correctly for x\y option sensitivity
-rw-r--r--grapher/Models/Fields/FieldXY.cs26
-rw-r--r--grapher/Models/Options/ActiveValueLabelXY.cs20
-rw-r--r--grapher/Models/Options/ApplyOptions.cs2
-rw-r--r--grapher/Models/Options/OptionXY.cs2
4 files changed, 47 insertions, 3 deletions
diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs
index 1c01668..a7db922 100644
--- a/grapher/Models/Fields/FieldXY.cs
+++ b/grapher/Models/Fields/FieldXY.cs
@@ -121,6 +121,32 @@ namespace grapher
#region Methods
+ public void SetActive(double x, double y)
+ {
+ XField.SetNewDefault(x);
+ YField.SetNewDefault(y);
+ XField.SetToDefault();
+
+ if (x != y)
+ {
+ LockCheckBox.Checked = false;
+
+ if (Combined)
+ {
+ SetSeparate();
+ }
+ }
+ else
+ {
+ LockCheckBox.Checked = true;
+
+ if (!Combined)
+ {
+ SetCombined();
+ }
+ }
+ }
+
private void CheckChanged(object sender, EventArgs e)
{
if (LockCheckBox.CheckState == CheckState.Checked)
diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs
index 9498c66..1367a6a 100644
--- a/grapher/Models/Options/ActiveValueLabelXY.cs
+++ b/grapher/Models/Options/ActiveValueLabelXY.cs
@@ -1,4 +1,6 @@
-namespace grapher.Models.Options
+using System.Drawing;
+
+namespace grapher.Models.Options
{
public class ActiveValueLabelXY
{
@@ -20,6 +22,14 @@
Y.Width = ShortenedWidth;
Y.FormatString = Constants.ShortenedFormatString;
+ X.ValueLabel.Margin = new System.Windows.Forms.Padding(0);
+ Y.ValueLabel.Margin = new System.Windows.Forms.Padding(0);
+ X.ValueLabel.UseCompatibleTextRendering = true;
+ Y.ValueLabel.UseCompatibleTextRendering = true;
+ DefaultFont = X.ValueLabel.Font;
+ ShortenedFont = new Font(DefaultFont.FontFamily, (float)7.75);
+ Y.ValueLabel.Font = ShortenedFont;
+
Combined = false;
SetCombined();
}
@@ -32,6 +42,10 @@
public ActiveValueLabel Y { get; }
+ public Font DefaultFont { get; }
+
+ public Font ShortenedFont { get; }
+
public bool Combined { get; private set; }
public int Left
@@ -90,6 +104,7 @@
X.FormatString = Constants.DefaultActiveValueFormatString;
X.Width = FullWidth;
X.Prefix = string.Empty;
+ X.ValueLabel.Font = DefaultFont;
Y.Hide();
}
@@ -103,6 +118,7 @@
X.FormatString = Constants.ShortenedFormatString;
X.Width = ShortenedWidth;
X.Prefix = "X";
+ X.ValueLabel.Font = ShortenedFont;
Y.Prefix = "Y";
Y.Show();
}
@@ -127,7 +143,7 @@
private void Align (int width)
{
FullWidth = width;
- ShortenedWidth = (FullWidth - Constants.ActiveLabelXYSeparation) / 2;
+ ShortenedWidth = FullWidth / 2;
SetYLeft();
Y.Width = ShortenedWidth;
diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs
index 720cb13..c2ed498 100644
--- a/grapher/Models/Options/ApplyOptions.cs
+++ b/grapher/Models/Options/ApplyOptions.cs
@@ -123,7 +123,7 @@ namespace grapher.Models.Options
{
SetActiveValues(
settings.sensitivity.x,
- settings.sensitivity.x,
+ settings.sensitivity.y,
settings.rotation,
(int)settings.modes.x,
(int)settings.modes.y,
diff --git a/grapher/Models/Options/OptionXY.cs b/grapher/Models/Options/OptionXY.cs
index 6d6129a..b4a2b27 100644
--- a/grapher/Models/Options/OptionXY.cs
+++ b/grapher/Models/Options/OptionXY.cs
@@ -123,6 +123,8 @@ namespace grapher
public void SetActiveValues(double x, double y)
{
ActiveValueLabels.SetValues(x, y);
+ Fields.SetActive(x, y);
+
}
public override void AlignActiveValues()