# HG changeset patch # User moel.mich # Date 1274390634 0 # Node ID 3ef997c53b501fc5c23d7d1de33b5b9a7c88e6b3 # Parent f7e492b436900253d7918d42fef462c1b20682d6 Fixed Issue 10. diff -r f7e492b43690 -r 3ef997c53b50 GUI/MainForm.Designer.cs --- a/GUI/MainForm.Designer.cs Tue May 18 19:16:55 2010 +0000 +++ b/GUI/MainForm.Designer.cs Thu May 20 21:23:54 2010 +0000 @@ -93,6 +93,10 @@ this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); + this.temperatureUnitsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.celciusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.fahrenheitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -122,7 +126,7 @@ this.treeView.Columns.Add(this.limit); this.treeView.DefaultToolTipProvider = null; this.treeView.Dock = System.Windows.Forms.DockStyle.Fill; - this.treeView.DragDropMarkColor = System.Drawing.Color.Black; + this.treeView.DragDropMarkColor = System.Drawing.Color.Black; this.treeView.FullRowSelect = true; this.treeView.GridLineStyle = Aga.Controls.Tree.GridLineStyle.Horizontal; this.treeView.LineColor = System.Drawing.SystemColors.ControlDark; @@ -138,7 +142,7 @@ this.treeView.NodeControls.Add(this.nodeTextBoxLimit); this.treeView.RowHeight = 18; this.treeView.SelectedNode = null; - this.treeView.Size = new System.Drawing.Size(478, 567); + this.treeView.Size = new System.Drawing.Size(410, 488); this.treeView.TabIndex = 0; this.treeView.Text = "treeView"; this.treeView.UseColumns = true; @@ -240,8 +244,7 @@ this.helpToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; - this.menuStrip.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); - this.menuStrip.Size = new System.Drawing.Size(478, 24); + this.menuStrip.Size = new System.Drawing.Size(410, 24); this.menuStrip.TabIndex = 1; this.menuStrip.Text = "menuStrip1"; // @@ -319,7 +322,7 @@ this.valueMenuItem.CheckOnClick = true; this.valueMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.valueMenuItem.Name = "valueMenuItem"; - this.valueMenuItem.Size = new System.Drawing.Size(152, 22); + this.valueMenuItem.Size = new System.Drawing.Size(103, 22); this.valueMenuItem.Text = "Value"; this.valueMenuItem.CheckedChanged += new System.EventHandler(this.valueMenuItem_CheckedChanged); // @@ -329,7 +332,7 @@ this.minMenuItem.CheckOnClick = true; this.minMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.minMenuItem.Name = "minMenuItem"; - this.minMenuItem.Size = new System.Drawing.Size(152, 22); + this.minMenuItem.Size = new System.Drawing.Size(103, 22); this.minMenuItem.Text = "Min"; this.minMenuItem.CheckedChanged += new System.EventHandler(this.minMenuItem_CheckedChanged); // @@ -339,7 +342,7 @@ this.maxMenuItem.CheckOnClick = true; this.maxMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.maxMenuItem.Name = "maxMenuItem"; - this.maxMenuItem.Size = new System.Drawing.Size(152, 22); + this.maxMenuItem.Size = new System.Drawing.Size(103, 22); this.maxMenuItem.Text = "Max"; this.maxMenuItem.CheckedChanged += new System.EventHandler(this.maxMenuItem_CheckedChanged); // @@ -349,7 +352,7 @@ this.limitMenuItem.CheckOnClick = true; this.limitMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.limitMenuItem.Name = "limitMenuItem"; - this.limitMenuItem.Size = new System.Drawing.Size(152, 22); + this.limitMenuItem.Size = new System.Drawing.Size(103, 22); this.limitMenuItem.Text = "Limit"; this.limitMenuItem.CheckedChanged += new System.EventHandler(this.limitMenuItem_CheckedChanged); // @@ -360,6 +363,8 @@ this.minTrayMenuItem, this.startupMenuItem, this.toolStripMenuItem3, + this.temperatureUnitsToolStripMenuItem, + this.toolStripMenuItem4, this.hddMenuItem}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); @@ -393,12 +398,40 @@ this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Size = new System.Drawing.Size(204, 6); // + // temperatureUnitsToolStripMenuItem + // + this.temperatureUnitsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.celciusToolStripMenuItem, + this.fahrenheitToolStripMenuItem}); + this.temperatureUnitsToolStripMenuItem.Name = "temperatureUnitsToolStripMenuItem"; + this.temperatureUnitsToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.temperatureUnitsToolStripMenuItem.Text = "Temperature Unit"; + // + // celciusToolStripMenuItem + // + this.celciusToolStripMenuItem.Name = "celciusToolStripMenuItem"; + this.celciusToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.celciusToolStripMenuItem.Text = "Celcius"; + this.celciusToolStripMenuItem.Click += new System.EventHandler(this.celciusToolStripMenuItem_Click); + // + // fahrenheitToolStripMenuItem + // + this.fahrenheitToolStripMenuItem.Name = "fahrenheitToolStripMenuItem"; + this.fahrenheitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.fahrenheitToolStripMenuItem.Text = "Fahrenheit"; + this.fahrenheitToolStripMenuItem.Click += new System.EventHandler(this.fahrenheitToolStripMenuItem_Click); + // + // toolStripMenuItem4 + // + this.toolStripMenuItem4.Name = "toolStripMenuItem4"; + this.toolStripMenuItem4.Size = new System.Drawing.Size(204, 6); + // // hddMenuItem // this.hddMenuItem.CheckOnClick = true; this.hddMenuItem.Name = "hddMenuItem"; this.hddMenuItem.Size = new System.Drawing.Size(207, 22); - this.hddMenuItem.Text = "HDD sensors"; + this.hddMenuItem.Text = "Read HDD sensors"; this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged); // // helpToolStripMenuItem @@ -431,18 +464,18 @@ // this.splitContainer.Panel2.Controls.Add(this.plotPanel); this.splitContainer.Panel2.Cursor = System.Windows.Forms.Cursors.Default; - this.splitContainer.Size = new System.Drawing.Size(478, 768); - this.splitContainer.SplitterDistance = 567; + this.splitContainer.Size = new System.Drawing.Size(410, 662); + this.splitContainer.SplitterDistance = 488; this.splitContainer.SplitterWidth = 3; this.splitContainer.TabIndex = 3; // // plotPanel // this.plotPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.plotPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.plotPanel.Location = new System.Drawing.Point(0, 0); this.plotPanel.Name = "plotPanel"; - this.plotPanel.Size = new System.Drawing.Size(478, 198); + this.plotPanel.Size = new System.Drawing.Size(410, 171); this.plotPanel.TabIndex = 0; // // notifyContextMenuStrip @@ -452,24 +485,24 @@ this.toolStripMenuItem2, this.exitToolStripMenuItem1}); this.notifyContextMenuStrip.Name = "notifyContextMenuStrip"; - this.notifyContextMenuStrip.Size = new System.Drawing.Size(137, 54); + this.notifyContextMenuStrip.Size = new System.Drawing.Size(134, 54); // // hideShowToolStripMenuItem - // + // this.hideShowToolStripMenuItem.Name = "hideShowToolStripMenuItem"; - this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(136, 22); + this.hideShowToolStripMenuItem.Size = new System.Drawing.Size(133, 22); this.hideShowToolStripMenuItem.Text = "Hide/Show"; this.hideShowToolStripMenuItem.Click += new System.EventHandler(this.hideShowClick); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(133, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(130, 6); // // exitToolStripMenuItem1 // this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1"; - this.exitToolStripMenuItem1.Size = new System.Drawing.Size(136, 22); + this.exitToolStripMenuItem1.Size = new System.Drawing.Size(133, 22); this.exitToolStripMenuItem1.Text = "Exit"; this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -493,11 +526,11 @@ // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(478, 792); + this.ClientSize = new System.Drawing.Size(410, 686); this.Controls.Add(this.splitContainer); - this.Controls.Add(this.menuStrip); + this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip; this.Name = "MainForm"; @@ -560,6 +593,10 @@ private System.Windows.Forms.ToolStripMenuItem minMenuItem; private System.Windows.Forms.ToolStripMenuItem maxMenuItem; private System.Windows.Forms.ToolStripMenuItem limitMenuItem; + private System.Windows.Forms.ToolStripMenuItem temperatureUnitsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; + private System.Windows.Forms.ToolStripMenuItem celciusToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem fahrenheitToolStripMenuItem; } } diff -r f7e492b43690 -r 3ef997c53b50 GUI/MainForm.cs --- a/GUI/MainForm.cs Tue May 18 19:16:55 2010 +0000 +++ b/GUI/MainForm.cs Thu May 20 21:23:54 2010 +0000 @@ -149,7 +149,11 @@ startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true); startupMenuItem.Checked = startupManager.Startup; - hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true); + hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true); + + celciusToolStripMenuItem.Checked = + UnitManager.TemperatureUnit == TemperatureUnit.Celcius; + fahrenheitToolStripMenuItem.Checked = !celciusToolStripMenuItem.Checked; if (startMinMenuItem.Checked) { if (!minTrayMenuItem.Checked) { @@ -439,5 +443,17 @@ private void limitMenuItem_CheckedChanged(object sender, EventArgs e) { treeView.Columns[4].IsVisible = limitMenuItem.Checked; } + + private void celciusToolStripMenuItem_Click(object sender, EventArgs e) { + celciusToolStripMenuItem.Checked = true; + fahrenheitToolStripMenuItem.Checked = false; + UnitManager.TemperatureUnit = TemperatureUnit.Celcius; + } + + private void fahrenheitToolStripMenuItem_Click(object sender, EventArgs e) { + celciusToolStripMenuItem.Checked = false; + fahrenheitToolStripMenuItem.Checked = true; + UnitManager.TemperatureUnit = TemperatureUnit.Fahrenheit; + } } } diff -r f7e492b43690 -r 3ef997c53b50 GUI/MainForm.resx --- a/GUI/MainForm.resx Tue May 18 19:16:55 2010 +0000 +++ b/GUI/MainForm.resx Thu May 20 21:23:54 2010 +0000 @@ -121,16 +121,16 @@ 17, 17 - 322, 17 + 125, 17 - 504, 17 + 307, 17 - 690, 17 + 493, 17 - 819, 17 + 622, 17 55 diff -r f7e492b43690 -r 3ef997c53b50 GUI/SensorNode.cs --- a/GUI/SensorNode.cs Tue May 18 19:16:55 2010 +0000 +++ b/GUI/SensorNode.cs Thu May 20 21:23:54 2010 +0000 @@ -48,9 +48,14 @@ private bool plot = false; public string ValueToString(float? value) { - if (value.HasValue) - return string.Format(format, value); - else + if (value.HasValue) { + if (sensor.SensorType == SensorType.Temperature && + UnitManager.TemperatureUnit == TemperatureUnit.Fahrenheit) { + return string.Format("{0:F1} °F", value * 1.8 + 32); + } else { + return string.Format(format, value); + } + } else return "-"; } diff -r f7e492b43690 -r 3ef997c53b50 GUI/UnitManager.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GUI/UnitManager.cs Thu May 20 21:23:54 2010 +0000 @@ -0,0 +1,66 @@ +/* + + 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.Utilities; + +namespace OpenHardwareMonitor.GUI { + + public enum TemperatureUnit { + Celcius = 0, + Fahrenheit = 1 + } + + public class UnitManager { + + private static TemperatureUnit temperatureUnit; + + static UnitManager () { + temperatureUnit = (TemperatureUnit)Config.Get("TemperatureUnit", + (int)TemperatureUnit.Celcius); + } + + public static TemperatureUnit TemperatureUnit { + get { return temperatureUnit; } + set { + temperatureUnit = value; + Config.Set("TemperatureUnit", (int)temperatureUnit); + } + } + } +} diff -r f7e492b43690 -r 3ef997c53b50 Hardware/CPU/AMD0FCPU.cs --- a/Hardware/CPU/AMD0FCPU.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/CPU/AMD0FCPU.cs Thu May 20 21:23:54 2010 +0000 @@ -90,7 +90,7 @@ coreTemperatures[i] = new Sensor("Core #" + (i + 1), i, null, SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset", + new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", offset) }); diff -r f7e492b43690 -r 3ef997c53b50 Hardware/CPU/AMD10CPU.cs --- a/Hardware/CPU/AMD10CPU.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/CPU/AMD10CPU.cs Thu May 20 21:23:54 2010 +0000 @@ -87,7 +87,7 @@ coreTemperature = new Sensor( "Core" + (coreCount > 1 ? " #1 - #" + coreCount : ""), 0, null, SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset", "Temperature offset.", 0) + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }); pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, diff -r f7e492b43690 -r 3ef997c53b50 Hardware/CPU/IntelCPU.cs --- a/Hardware/CPU/IntelCPU.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/CPU/IntelCPU.cs Thu May 20 21:23:54 2010 +0000 @@ -175,10 +175,10 @@ coreTemperatures[i] = new Sensor(CoreString(i), i, tjMax[i], SensorType.Temperature, this, new ParameterDescription[] { new ParameterDescription( - "TjMax", "TjMax temperature of the core.\n" + + "TjMax [°C]", "TjMax temperature of the core.\n" + "Temperature = TjMax - TSlope * Value.", tjMax[i]), - new ParameterDescription( - "TSlope", "Temperature slope of the digital thermal sensor.\n" + + new ParameterDescription("TSlope [°C]", + "Temperature slope of the digital thermal sensor.\n" + "Temperature = TjMax - TSlope * Value.", 1)}); } } else { diff -r f7e492b43690 -r 3ef997c53b50 Hardware/LPC/F718XX.cs --- a/Hardware/LPC/F718XX.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/LPC/F718XX.cs Thu May 20 21:23:54 2010 +0000 @@ -73,7 +73,7 @@ for (int i = 0; i < temperatures.Length; i++) temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null, SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset", "Temperature offset.", 0) + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }); fans = new Sensor[chip == Chip.F71882 ? 4 : 3]; diff -r f7e492b43690 -r 3ef997c53b50 Hardware/LPC/IT87XX.cs --- a/Hardware/LPC/IT87XX.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/LPC/IT87XX.cs Thu May 20 21:23:54 2010 +0000 @@ -101,7 +101,7 @@ for (int i = 0; i < temperatures.Length; i++) temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null, SensorType.Temperature, this, new ParameterDescription[] { - new ParameterDescription("Offset", "Temperature offset.", 0) + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }); fans = new Sensor[5]; diff -r f7e492b43690 -r 3ef997c53b50 Hardware/LPC/W836XX.cs --- a/Hardware/LPC/W836XX.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/LPC/W836XX.cs Thu May 20 21:23:54 2010 +0000 @@ -112,7 +112,7 @@ available = IsWinbondVendor(); ParameterDescription[] parameter = new ParameterDescription[] { - new ParameterDescription("Offset", "Temperature offset.", 0) + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }; List list = new List(); switch (chip) { diff -r f7e492b43690 -r 3ef997c53b50 Hardware/TBalancer/TBalancer.cs --- a/Hardware/TBalancer/TBalancer.cs Tue May 18 19:16:55 2010 +0000 +++ b/Hardware/TBalancer/TBalancer.cs Thu May 20 21:23:54 2010 +0000 @@ -73,7 +73,7 @@ this.protocolVersion = protocolVersion; ParameterDescription[] parameter = new ParameterDescription[] { - new ParameterDescription("Offset", "Temperature offset.", 0) + new ParameterDescription("Offset [°C]", "Temperature offset.", 0) }; int offset = 0; for (int i = 0; i < digitalTemperatures.Length; i++) diff -r f7e492b43690 -r 3ef997c53b50 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Tue May 18 19:16:55 2010 +0000 +++ b/OpenHardwareMonitor.csproj Thu May 20 21:23:54 2010 +0000 @@ -79,6 +79,7 @@ +