mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 07:15:31 +00:00
Added a menu item to reset the pen color (to use again the plotColorPalette based color). Moved the saving/loading code to the SensorNode class (as with the other properties).
This commit is contained in:
@@ -89,8 +89,6 @@ 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);
|
||||
}
|
||||
|
2
GUI/MainForm.Designer.cs
generated
2
GUI/MainForm.Designer.cs
generated
@@ -111,7 +111,6 @@ 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();
|
||||
@@ -763,7 +762,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -494,7 +494,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
SensorNode sensorNode = node.Tag as SensorNode;
|
||||
if (sensorNode != null) {
|
||||
if (sensorNode.Plot) {
|
||||
if (sensorNode.penColor == null) {
|
||||
if (!sensorNode.PenColor.HasValue) {
|
||||
colors.Add(sensorNode.Sensor,
|
||||
plotColorPalette[colorIndex % plotColorPalette.Length]);
|
||||
}
|
||||
@@ -528,8 +528,8 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
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);
|
||||
if (sensorNode != null && sensorNode.Plot && sensorNode.PenColor.HasValue)
|
||||
colors.Add(sensorNode.Sensor, sensorNode.PenColor.Value);
|
||||
}
|
||||
|
||||
sensorPlotColors = colors;
|
||||
@@ -683,17 +683,23 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
treeContextMenu.MenuItems.Add(new MenuItem("-"));
|
||||
{
|
||||
MenuItem item = new MenuItem("Pen color");
|
||||
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);
|
||||
}
|
||||
ColorDialog dialog = new ColorDialog();
|
||||
dialog.Color = node.PenColor.GetValueOrDefault();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
node.PenColor = dialog.Color;
|
||||
};
|
||||
treeContextMenu.MenuItems.Add(item);
|
||||
}
|
||||
{
|
||||
MenuItem item = new MenuItem("Reset Pen Color");
|
||||
item.Click += delegate(object obj, EventArgs args) {
|
||||
node.PenColor = null;
|
||||
};
|
||||
treeContextMenu.MenuItems.Add(item);
|
||||
}
|
||||
treeContextMenu.MenuItems.Add(new MenuItem("-"));
|
||||
{
|
||||
MenuItem item = new MenuItem("Show in Tray");
|
||||
item.Checked = systemTray.Contains(node.Sensor);
|
||||
|
@@ -129,9 +129,6 @@
|
||||
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>293, 17</value>
|
||||
</metadata>
|
||||
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>483, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
|
||||
Copyright (C) 2009-2016 Michael Möller <mmoeller@openhardwaremonitor.org>
|
||||
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenHardwareMonitor.GUI {
|
||||
private UnitManager unitManager;
|
||||
private string format;
|
||||
private bool plot = false;
|
||||
public Color? penColor = null;
|
||||
private Color? penColor = null;
|
||||
|
||||
public string ValueToString(float? value) {
|
||||
if (value.HasValue) {
|
||||
@@ -61,6 +61,10 @@ namespace OpenHardwareMonitor.GUI {
|
||||
|
||||
this.Plot = settings.GetValue(new Identifier(sensor.Identifier,
|
||||
"plot").ToString(), false);
|
||||
|
||||
string id = new Identifier(sensor.Identifier, "penColor").ToString();
|
||||
if (settings.Contains(id))
|
||||
this.PenColor = settings.GetValue(id, Color.Black);
|
||||
}
|
||||
|
||||
public override string Text {
|
||||
@@ -77,6 +81,22 @@ namespace OpenHardwareMonitor.GUI {
|
||||
}
|
||||
}
|
||||
|
||||
public Color? PenColor {
|
||||
get { return penColor; }
|
||||
set {
|
||||
penColor = value;
|
||||
|
||||
string id = new Identifier(sensor.Identifier, "penColor").ToString();
|
||||
if (value.HasValue)
|
||||
settings.SetValue(id, value.Value);
|
||||
else
|
||||
settings.Remove(id);
|
||||
|
||||
if (PlotSelectionChanged != null)
|
||||
PlotSelectionChanged(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Plot {
|
||||
get { return plot; }
|
||||
set {
|
||||
|
@@ -66,7 +66,6 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
|
Reference in New Issue
Block a user