diff --git a/GUI/HardwareNode.cs b/GUI/HardwareNode.cs index a68289e..0e2e463 100644 --- a/GUI/HardwareNode.cs +++ b/GUI/HardwareNode.cs @@ -89,6 +89,8 @@ namespace OpenHardwareMonitor.GUI { ((SensorNode)node.Nodes[i]).Sensor.Index < sensor.Index) i++; SensorNode sensorNode = new SensorNode(sensor, settings, unitManager); + if (settings.Contains(sensor.Identifier + "/PenColor")) + sensorNode.penColor = settings.GetValue(sensor.Identifier + "/PenColor", Color.Black); sensorNode.PlotSelectionChanged += SensorPlotSelectionChanged; node.Nodes.Insert(i, sensorNode); } diff --git a/GUI/MainForm.Designer.cs b/GUI/MainForm.Designer.cs index f602030..ffc345e 100644 --- a/GUI/MainForm.Designer.cs +++ b/GUI/MainForm.Designer.cs @@ -111,6 +111,7 @@ namespace OpenHardwareMonitor.GUI { this.log1hMenuItem = new System.Windows.Forms.MenuItem(); this.log2hMenuItem = new System.Windows.Forms.MenuItem(); this.log6hMenuItem = new System.Windows.Forms.MenuItem(); + this.colorDialog = new System.Windows.Forms.ColorDialog(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.SuspendLayout(); this.SuspendLayout(); @@ -762,6 +763,7 @@ namespace OpenHardwareMonitor.GUI { private System.Windows.Forms.MenuItem log1hMenuItem; private System.Windows.Forms.MenuItem log2hMenuItem; private System.Windows.Forms.MenuItem log6hMenuItem; + private System.Windows.Forms.ColorDialog colorDialog; } } diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index 7f11cca..bee6263 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -494,8 +494,10 @@ namespace OpenHardwareMonitor.GUI { SensorNode sensorNode = node.Tag as SensorNode; if (sensorNode != null) { if (sensorNode.Plot) { - colors.Add(sensorNode.Sensor, - plotColorPalette[colorIndex % plotColorPalette.Length]); + if (sensorNode.penColor == null) { + colors.Add(sensorNode.Sensor, + plotColorPalette[colorIndex % plotColorPalette.Length]); + } selected.Add(sensorNode.Sensor); } colorIndex++; @@ -509,6 +511,7 @@ namespace OpenHardwareMonitor.GUI { // from the plot var usedColors = new List(); foreach (var curSelectedSensor in selected) { + if (!colors.ContainsKey(curSelectedSensor)) continue; var curColor = colors[curSelectedSensor]; if (usedColors.Contains(curColor)) { foreach (var potentialNewColor in plotColorPalette) { @@ -521,7 +524,13 @@ namespace OpenHardwareMonitor.GUI { } else { usedColors.Add(curColor); } - } + } + + foreach (TreeNodeAdv node in treeView.AllNodes) { + SensorNode sensorNode = node.Tag as SensorNode; + if (sensorNode != null && sensorNode.Plot && sensorNode.penColor != null) + colors.Add(sensorNode.Sensor, sensorNode.penColor.Value); + } sensorPlotColors = colors; plotPanel.SetSensors(selected, colors); @@ -673,6 +682,18 @@ namespace OpenHardwareMonitor.GUI { treeContextMenu.MenuItems.Add(item); } treeContextMenu.MenuItems.Add(new MenuItem("-")); + { + MenuItem item = new MenuItem("Pen color"); + item.Click += delegate(object obj, EventArgs args) { + colorDialog.Color = node.penColor.GetValueOrDefault(); + if (colorDialog.ShowDialog() == DialogResult.OK) { + node.penColor = colorDialog.Color; + settings.SetValue(node.Sensor.Identifier + "/PenColor", colorDialog.Color); + PlotSelectionChanged(this, null); + } + }; + treeContextMenu.MenuItems.Add(item); + } { MenuItem item = new MenuItem("Show in Tray"); item.Checked = systemTray.Contains(node.Sensor); diff --git a/GUI/MainForm.resx b/GUI/MainForm.resx index 9cb27cf..1a380ff 100644 --- a/GUI/MainForm.resx +++ b/GUI/MainForm.resx @@ -129,6 +129,9 @@ 293, 17 + + 483, 17 + diff --git a/GUI/SensorNode.cs b/GUI/SensorNode.cs index 876ccba..7493b8b 100644 --- a/GUI/SensorNode.cs +++ b/GUI/SensorNode.cs @@ -9,6 +9,7 @@ */ using System; +using System.Drawing; using System.Collections.Generic; using OpenHardwareMonitor.Hardware; using OpenHardwareMonitor.Utilities; @@ -20,7 +21,8 @@ namespace OpenHardwareMonitor.GUI { private PersistentSettings settings; private UnitManager unitManager; private string format; - private bool plot = false; + private bool plot = false; + public Color? penColor = null; public string ValueToString(float? value) { if (value.HasValue) { diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index 35e749b..68a994c 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -66,6 +66,7 @@ +