diff options
| author | a1xd <[email protected]> | 2021-09-15 06:41:57 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:34:51 -0400 |
| commit | 7c0305ae2c99c191baf61eb920025826057d5753 (patch) | |
| tree | 6a394d4ac8d69436f7bd8f1255f1d4fd3439280c /grapher/Models/AccelGUI.cs | |
| parent | fix potential leaks (diff) | |
| download | rawaccel-7c0305ae2c99c191baf61eb920025826057d5753.tar.xz rawaccel-7c0305ae2c99c191baf61eb920025826057d5753.zip | |
add device menu
Diffstat (limited to 'grapher/Models/AccelGUI.cs')
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 1836b65..51e31a6 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -4,6 +4,7 @@ using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; using System; +using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; @@ -24,7 +25,8 @@ namespace grapher Button writeButton, ButtonBase resetButton, MouseWatcher mouseWatcher, - ToolStripMenuItem scaleMenuItem) + ToolStripMenuItem scaleMenuItem, + ToolStripMenuItem deviceMenuItem) { AccelForm = accelForm; AccelCalculator = accelCalculator; @@ -33,11 +35,13 @@ namespace grapher WriteButton = writeButton; ResetButton = (CheckBox)resetButton; ScaleMenuItem = scaleMenuItem; + DeviceMenuItem = deviceMenuItem; Settings = settings; DefaultButtonFont = WriteButton.Font; SmallButtonFont = new Font(WriteButton.Font.Name, WriteButton.Font.Size * Constants.SmallButtonSizeFactor); MouseWatcher = mouseWatcher; + DeviceMenuItem.Click += DeviceMenuItemClick; ScaleMenuItem.Click += new System.EventHandler(OnScaleMenuItemClick); WriteButton.Click += new System.EventHandler(OnWriteButtonClick); ResetButton.Click += new System.EventHandler(ResetDriverEventHandler); @@ -83,6 +87,8 @@ namespace grapher public ToolStripMenuItem ScaleMenuItem { get; } + public ToolStripMenuItem DeviceMenuItem { get; } + private Timer ChartRefresh { get; } private Font SmallButtonFont { get; } @@ -146,6 +152,7 @@ namespace grapher else { RefreshActive(); + Settings.SetActiveHandles(); return; } } @@ -240,10 +247,12 @@ namespace grapher { ButtonTimer.Stop(); SetButtonDefaults(); + DeviceMenuItem.Enabled = true; } private void StartButtonTimer() { + DeviceMenuItem.Enabled = false; ButtonTimer.Interval = ButtonTimerInterval; ButtonTimer.Start(); } @@ -268,6 +277,18 @@ namespace grapher MouseWatcher.UpdateLastMove(); } + private void DeviceMenuItemClick(object sender, EventArgs e) + { + using (var devMenu = new DeviceMenuForm(Settings)) + { + if (devMenu.ShowDialog() == DialogResult.OK) + { + Settings.Submit(devMenu.defaultConfig, devMenu.Items); + UpdateActiveSettingsFromFields(); + } + } + } + #endregion Methods } |