# HG changeset patch # User moel.mich # Date 1278247756 0 # Node ID 76e18684713de0680ac7424b730b61fca8cd76c3 # Parent 522da3b8cb1aa2ebf4c018f0b019855038eee9f7 Fixed Issue 82. diff -r 522da3b8cb1a -r 76e18684713d GUI/MainForm.Designer.cs --- a/GUI/MainForm.Designer.cs Sun Jul 04 12:12:37 2010 +0000 +++ b/GUI/MainForm.Designer.cs Sun Jul 04 12:49:16 2010 +0000 @@ -76,6 +76,8 @@ this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hiddenMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -102,8 +104,8 @@ this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.timer = new System.Windows.Forms.Timer(this.components); - this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); - this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); + this.resetMinMaxMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip.SuspendLayout(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -243,6 +245,18 @@ this.saveReportToolStripMenuItem.Text = "Save Report..."; this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click); // + // sumbitReportToolStripMenuItem + // + this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem"; + this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); + this.sumbitReportToolStripMenuItem.Text = "Submit Report..."; + this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6); + // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; @@ -253,6 +267,8 @@ // viewToolStripMenuItem // this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.resetMinMaxMenuItem, + this.toolStripMenuItem3, this.hiddenMenuItem, this.plotMenuItem, this.toolStripMenuItem1, @@ -464,17 +480,17 @@ this.timer.Interval = 1000; this.timer.Tick += new System.EventHandler(this.timer_Tick); // - // toolStripMenuItem2 + // toolStripMenuItem3 // - this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6); + this.toolStripMenuItem3.Name = "toolStripMenuItem3"; + this.toolStripMenuItem3.Size = new System.Drawing.Size(185, 6); // - // sumbitReportToolStripMenuItem + // resetMinMaxMenuItem // - this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem"; - this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); - this.sumbitReportToolStripMenuItem.Text = "Submit Report..."; - this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click); + this.resetMinMaxMenuItem.Name = "resetMinMaxMenuItem"; + this.resetMinMaxMenuItem.Size = new System.Drawing.Size(188, 22); + this.resetMinMaxMenuItem.Text = "Reset Min/Max"; + this.resetMinMaxMenuItem.Click += new System.EventHandler(this.resetMinMaxMenuItem_Click); // // MainForm // @@ -543,6 +559,8 @@ private System.Windows.Forms.ToolStripMenuItem fahrenheitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem sumbitReportToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem resetMinMaxMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; } } diff -r 522da3b8cb1a -r 76e18684713d GUI/MainForm.cs --- a/GUI/MainForm.cs Sun Jul 04 12:12:37 2010 +0000 +++ b/GUI/MainForm.cs Sun Jul 04 12:49:16 2010 +0000 @@ -462,5 +462,10 @@ form.Report = computer.GetReport(); form.ShowDialog(); } + + private void resetMinMaxMenuItem_Click(object sender, EventArgs e) { + IVisitor visitor = new ResetMinMaxVisitor(); + computer.Accept(visitor); + } } } diff -r 522da3b8cb1a -r 76e18684713d GUI/ResetMinMaxVisitor.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/ResetMinMaxVisitor.cs Sun Jul 04 12:49:16 2010 +0000 @@ -0,0 +1,59 @@ +/* + + Version: MPL 1.1/GPL 2.0/LGPL 2.1 + + The contents of this file are subject to the Mozilla Public License Version + 1.1 (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + for the specific language governing rights and limitations under the License. + + The Original Code is the Open Hardware Monitor code. + + The Initial Developer of the Original Code is + Michael Möller . + Portions created by the Initial Developer are Copyright (C) 2009-2010 + the Initial Developer. All Rights Reserved. + + Contributor(s): + + Alternatively, the contents of this file may be used under the terms of + either the GNU General Public License Version 2 or later (the "GPL"), or + the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + in which case the provisions of the GPL or the LGPL are applicable instead + of those above. If you wish to allow use of your version of this file only + under the terms of either the GPL or the LGPL, and not to allow others to + use your version of this file under the terms of the MPL, indicate your + decision by deleting the provisions above and replace them with the notice + and other provisions required by the GPL or the LGPL. If you do not delete + the provisions above, a recipient may use your version of this file under + the terms of any one of the MPL, the GPL or the LGPL. + +*/ + +using System; +using System.Collections.Generic; +using OpenHardwareMonitor.Hardware; + +namespace OpenHardwareMonitor.GUI { + public class ResetMinMaxVisitor : IVisitor { + public void VisitComputer(IComputer computer) { + computer.Traverse(this); + } + + public void VisitHardware(IHardware hardware) { + hardware.Traverse(this); + } + + public void VisitSensor(ISensor sensor) { + sensor.ResetMin(); + sensor.ResetMax(); + } + + public void VisitParameter(IParameter parameter) { } + } +} diff -r 522da3b8cb1a -r 76e18684713d Hardware/ISensor.cs --- a/Hardware/ISensor.cs Sun Jul 04 12:12:37 2010 +0000 +++ b/Hardware/ISensor.cs Sun Jul 04 12:49:16 2010 +0000 @@ -72,7 +72,10 @@ float? Value { get; } float? Min { get; } - float? Max { get; } + float? Max { get; } + + void ResetMin(); + void ResetMax(); IEnumerable Plot { get; } } diff -r 522da3b8cb1a -r 76e18684713d Hardware/Sensor.cs --- a/Hardware/Sensor.cs Sun Jul 04 12:12:37 2010 +0000 +++ b/Hardware/Sensor.cs Sun Jul 04 12:49:16 2010 +0000 @@ -163,6 +163,14 @@ public float? Min { get { return min; } } public float? Max { get { return max; } } + public void ResetMin() { + min = null; + } + + public void ResetMax() { + max = null; + } + public IEnumerable Plot { get { return entries; } } diff -r 522da3b8cb1a -r 76e18684713d OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Sun Jul 04 12:12:37 2010 +0000 +++ b/OpenHardwareMonitor.csproj Sun Jul 04 12:49:16 2010 +0000 @@ -80,6 +80,7 @@ ParameterForm.cs + diff -r 522da3b8cb1a -r 76e18684713d Properties/AssemblyInfo.cs --- a/Properties/AssemblyInfo.cs Sun Jul 04 12:12:37 2010 +0000 +++ b/Properties/AssemblyInfo.cs Sun Jul 04 12:49:16 2010 +0000 @@ -69,5 +69,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.36.0")] -[assembly: AssemblyFileVersion("0.1.36.0")] +[assembly: AssemblyVersion("0.1.37.0")] +[assembly: AssemblyFileVersion("0.1.37.0")]