From 137e91e0ad0139731fe627b119b201ed34252099 Mon Sep 17 00:00:00 2001 From: KitVanDeBunt Date: Wed, 15 Nov 2023 19:20:22 +0100 Subject: [PATCH] Attached plot panel fixed width plot or sensor panel (#1179) * Plot panel right fixed width when chnaging window width * Fixed with plot panel or sensor panel as an option * Fixed capitalisation of menu items. Edited the names of menu items added for split panel scaling options. Corrected some variable names to corrospond to menu item name changes. --- LibreHardwareMonitor/UI/MainForm.Designer.cs | 40 ++++++++++++++++++++ LibreHardwareMonitor/UI/MainForm.cs | 21 +++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/LibreHardwareMonitor/UI/MainForm.Designer.cs b/LibreHardwareMonitor/UI/MainForm.Designer.cs index 8fa2e12..18d0163 100644 --- a/LibreHardwareMonitor/UI/MainForm.Designer.cs +++ b/LibreHardwareMonitor/UI/MainForm.Designer.cs @@ -87,6 +87,10 @@ namespace LibreHardwareMonitor.UI this.plotWindowMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); this.plotBottomMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); this.plotRightMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); + this.splitPlotPanelScalingMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.splitPanelPercentageScalingMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); + this.splitPanelFixedPlotScalingMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); + this.splitPanelFixedSensorScalingMenuItem = new LibreHardwareMonitor.UI.ToolStripRadioButtonMenuItem(); this.logSeparatorMenuItem = new System.Windows.Forms.ToolStripSeparator(); this.logSensorsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loggingIntervalMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -437,6 +441,7 @@ namespace LibreHardwareMonitor.UI this.separatorMenuItem, this.temperatureUnitsMenuItem, this.plotLocationMenuItem, + this.splitPlotPanelScalingMenuItem, this.logSeparatorMenuItem, this.logSensorsMenuItem, this.loggingIntervalMenuItem, @@ -533,6 +538,37 @@ namespace LibreHardwareMonitor.UI this.plotRightMenuItem.Size = new System.Drawing.Size(118, 22); this.plotRightMenuItem.Text = "Right"; // + // attachedPlotPanelScalingMenuItem + // + this.splitPlotPanelScalingMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.splitPanelPercentageScalingMenuItem, + this.splitPanelFixedPlotScalingMenuItem, + this.splitPanelFixedSensorScalingMenuItem}); + this.splitPlotPanelScalingMenuItem.Name = "attachedPlotPanelScalingMenuItem"; + this.splitPlotPanelScalingMenuItem.Size = new System.Drawing.Size(221, 22); + this.splitPlotPanelScalingMenuItem.Text = "Split Panel Scaling Mode"; + // + // attachedPanelPercentageScalingMenuItem + // + this.splitPanelPercentageScalingMenuItem.CheckOnClick = true; + this.splitPanelPercentageScalingMenuItem.Name = "attachedPlotPanelPercentageScalingMenuItem"; + this.splitPanelPercentageScalingMenuItem.Size = new System.Drawing.Size(118, 22); + this.splitPanelPercentageScalingMenuItem.Text = "Percentage Scaling"; + // + // attachedPanelFixedWidthPlotPanelScalingMenuItem + // + this.splitPanelFixedPlotScalingMenuItem.CheckOnClick = true; + this.splitPanelFixedPlotScalingMenuItem.Name = "attachedBottomMenuItem"; + this.splitPanelFixedPlotScalingMenuItem.Size = new System.Drawing.Size(118, 22); + this.splitPanelFixedPlotScalingMenuItem.Text = "Fixed Size Plot Panel"; + // + // attachedPanelFixedWidthSensorPanelScalingMenuItem + // + this.splitPanelFixedSensorScalingMenuItem.CheckOnClick = true; + this.splitPanelFixedSensorScalingMenuItem.Name = "attachedRightMenuItem"; + this.splitPanelFixedSensorScalingMenuItem.Size = new System.Drawing.Size(118, 22); + this.splitPanelFixedSensorScalingMenuItem.Text = "Fixed Size Sensor Panel"; + // // logSeparatorMenuItem // this.logSeparatorMenuItem.Name = "logSeparatorMenuItem"; @@ -1012,6 +1048,10 @@ namespace LibreHardwareMonitor.UI private ToolStripRadioButtonMenuItem plotWindowMenuItem; private ToolStripRadioButtonMenuItem plotBottomMenuItem; private ToolStripRadioButtonMenuItem plotRightMenuItem; + private System.Windows.Forms.ToolStripMenuItem splitPlotPanelScalingMenuItem; + private ToolStripRadioButtonMenuItem splitPanelPercentageScalingMenuItem; + private ToolStripRadioButtonMenuItem splitPanelFixedPlotScalingMenuItem; + private ToolStripRadioButtonMenuItem splitPanelFixedSensorScalingMenuItem; private System.Windows.Forms.ToolStripMenuItem webMenuItem; private System.Windows.Forms.ToolStripMenuItem runWebServerMenuItem; private System.Windows.Forms.ToolStripMenuItem serverPortMenuItem; diff --git a/LibreHardwareMonitor/UI/MainForm.cs b/LibreHardwareMonitor/UI/MainForm.cs index 23e20e8..6e47b0d 100644 --- a/LibreHardwareMonitor/UI/MainForm.cs +++ b/LibreHardwareMonitor/UI/MainForm.cs @@ -55,6 +55,7 @@ public sealed partial class MainForm : Form private int _delayCount; private Form _plotForm; private UserRadioGroup _plotLocation; + private UserRadioGroup _splitPanelScalingSetting; private bool _selectionDragging; private IDictionary _sensorPlotColors = new Dictionary(); private UserOption _showPlot; @@ -507,6 +508,7 @@ public sealed partial class MainForm : Form _showPlot = new UserOption("plotMenuItem", false, plotMenuItem, _settings); _plotLocation = new UserRadioGroup("plotLocation", 0, new[] { plotWindowMenuItem, plotBottomMenuItem, plotRightMenuItem }, _settings); + _splitPanelScalingSetting = new UserRadioGroup("splitPanelScalingSetting", 0, new[] { splitPanelPercentageScalingMenuItem, splitPanelFixedPlotScalingMenuItem, splitPanelFixedSensorScalingMenuItem }, _settings); _showPlot.Changed += delegate { @@ -535,7 +537,6 @@ public sealed partial class MainForm : Form _plotForm.Controls.Add(_plotPanel); if (_showPlot.Value && Visible) _plotForm.Show(); - break; case 1: _plotForm.Controls.Clear(); @@ -554,6 +555,22 @@ public sealed partial class MainForm : Form } }; + _splitPanelScalingSetting.Changed += delegate + { + switch (_splitPanelScalingSetting.Value) + { + case 0: + splitContainer.FixedPanel = FixedPanel.None; + break; + case 1: + splitContainer.FixedPanel = FixedPanel.Panel2; + break; + case 2: + splitContainer.FixedPanel = FixedPanel.Panel1; + break; + } + }; + _plotForm.FormClosing += delegate(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) @@ -1155,4 +1172,4 @@ public sealed partial class MainForm : Form { new AuthForm(this).ShowDialog(); } -} \ No newline at end of file +}