Merge branch 'Added customizable pen colors'

This commit is contained in:
Michael Möller
2016-11-06 15:03:14 +01:00
2 changed files with 54 additions and 5 deletions
+24 -2
View File
@@ -4,11 +4,12 @@
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>
*/
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;
private Color? penColor = null;
public string ValueToString(float? value) {
if (value.HasValue) {
@@ -60,6 +62,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 {
@@ -76,6 +82,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 {