Replaced all menus with the native implementations MainMenu and ContextMenu. Fixed a bug with the sensor renaming context menu.

This commit is contained in:
Michael Möller
2010-07-18 12:38:01 +00:00
parent 9c7e97672b
commit 660c4baac1
8 changed files with 378 additions and 357 deletions

385
GUI/MainForm.Designer.cs generated
View File

@@ -73,40 +73,39 @@ namespace OpenHardwareMonitor.GUI {
this.nodeTextBoxValue = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeTextBoxValue = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this.nodeTextBoxMin = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeTextBoxMin = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this.nodeTextBoxMax = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeTextBoxMax = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this.menuStrip = new System.Windows.Forms.MenuStrip(); this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileMenuItem = new System.Windows.Forms.MenuItem();
this.saveReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveReportMenuItem = new System.Windows.Forms.MenuItem();
this.sumbitReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sumbitReportMenuItem = new System.Windows.Forms.MenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.MenuItem2 = new System.Windows.Forms.MenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitMenuItem = new System.Windows.Forms.MenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewMenuItem = new System.Windows.Forms.MenuItem();
this.hiddenMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetMinMaxMenuItem = new System.Windows.Forms.MenuItem();
this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuItem3 = new System.Windows.Forms.MenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); this.hiddenMenuItem = new System.Windows.Forms.MenuItem();
this.columnsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.plotMenuItem = new System.Windows.Forms.MenuItem();
this.valueMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuItem1 = new System.Windows.Forms.MenuItem();
this.minMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.columnsMenuItem = new System.Windows.Forms.MenuItem();
this.maxMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.valueMenuItem = new System.Windows.Forms.MenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.minMenuItem = new System.Windows.Forms.MenuItem();
this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.maxMenuItem = new System.Windows.Forms.MenuItem();
this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsMenuItem = new System.Windows.Forms.MenuItem();
this.startupMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startMinMenuItem = new System.Windows.Forms.MenuItem();
this.separatorMenuItem = new System.Windows.Forms.ToolStripSeparator(); this.minTrayMenuItem = new System.Windows.Forms.MenuItem();
this.temperatureUnitsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startupMenuItem = new System.Windows.Forms.MenuItem();
this.celciusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.separatorMenuItem = new System.Windows.Forms.MenuItem();
this.fahrenheitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.temperatureUnitsMenuItem = new System.Windows.Forms.MenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator(); this.celciusMenuItem = new System.Windows.Forms.MenuItem();
this.hddMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fahrenheitMenuItem = new System.Windows.Forms.MenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MenuItem4 = new System.Windows.Forms.MenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hddMenuItem = new System.Windows.Forms.MenuItem();
this.helpMenuItem = new System.Windows.Forms.MenuItem();
this.aboutMenuItem = new System.Windows.Forms.MenuItem();
this.splitContainer = new System.Windows.Forms.SplitContainer(); this.splitContainer = new System.Windows.Forms.SplitContainer();
this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel(); this.plotPanel = new OpenHardwareMonitor.GUI.PlotPanel();
this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.sensorContextMenu = new System.Windows.Forms.ContextMenu();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.timer = new System.Windows.Forms.Timer(this.components); this.timer = new System.Windows.Forms.Timer(this.components);
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.resetMinMaxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout(); this.splitContainer.SuspendLayout();
@@ -136,7 +135,7 @@ namespace OpenHardwareMonitor.GUI {
this.treeView.NodeControls.Add(this.nodeTextBoxMax); this.treeView.NodeControls.Add(this.nodeTextBoxMax);
this.treeView.RowHeight = 18; this.treeView.RowHeight = 18;
this.treeView.SelectedNode = null; this.treeView.SelectedNode = null;
this.treeView.Size = new System.Drawing.Size(410, 488); this.treeView.Size = new System.Drawing.Size(386, 488);
this.treeView.TabIndex = 0; this.treeView.TabIndex = 0;
this.treeView.Text = "treeView"; this.treeView.Text = "treeView";
this.treeView.UseColumns = true; this.treeView.UseColumns = true;
@@ -214,229 +213,188 @@ namespace OpenHardwareMonitor.GUI {
this.nodeTextBoxMax.LeftMargin = 3; this.nodeTextBoxMax.LeftMargin = 3;
this.nodeTextBoxMax.ParentColumn = this.max; this.nodeTextBoxMax.ParentColumn = this.max;
// //
// menuStrip // mainMenu
// //
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.fileToolStripMenuItem, this.fileMenuItem,
this.viewToolStripMenuItem, this.viewMenuItem,
this.optionsToolStripMenuItem, this.optionsMenuItem,
this.helpToolStripMenuItem}); this.helpMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(410, 24);
this.menuStrip.TabIndex = 1;
this.menuStrip.Text = "menuStrip1";
// //
// fileToolStripMenuItem // fileMenuItem
// //
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileMenuItem.Index = 0;
this.saveReportToolStripMenuItem, this.fileMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.sumbitReportToolStripMenuItem, this.saveReportMenuItem,
this.toolStripMenuItem2, this.sumbitReportMenuItem,
this.exitToolStripMenuItem}); this.MenuItem2,
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.exitMenuItem});
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.fileMenuItem.Text = "File";
this.fileToolStripMenuItem.Text = "File";
// //
// saveReportToolStripMenuItem // saveReportMenuItem
// //
this.saveReportToolStripMenuItem.Name = "saveReportToolStripMenuItem"; this.saveReportMenuItem.Index = 0;
this.saveReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.saveReportMenuItem.Text = "Save Report...";
this.saveReportToolStripMenuItem.Text = "Save Report..."; this.saveReportMenuItem.Click += new System.EventHandler(this.saveReportMenuItem_Click);
this.saveReportToolStripMenuItem.Click += new System.EventHandler(this.saveReportToolStripMenuItem_Click);
// //
// sumbitReportToolStripMenuItem // sumbitReportMenuItem
// //
this.sumbitReportToolStripMenuItem.Name = "sumbitReportToolStripMenuItem"; this.sumbitReportMenuItem.Index = 1;
this.sumbitReportToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.sumbitReportMenuItem.Text = "Submit Report...";
this.sumbitReportToolStripMenuItem.Text = "Submit Report..."; this.sumbitReportMenuItem.Click += new System.EventHandler(this.sumbitReportMenuItem_Click);
this.sumbitReportToolStripMenuItem.Click += new System.EventHandler(this.sumbitReportToolStripMenuItem_Click);
// //
// toolStripMenuItem2 // MenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.MenuItem2.Index = 2;
this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6); this.MenuItem2.Text = "-";
// //
// exitToolStripMenuItem // exitMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitMenuItem.Index = 3;
this.exitToolStripMenuItem.Size = new System.Drawing.Size(159, 22); this.exitMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Text = "Exit"; this.exitMenuItem.Click += new System.EventHandler(this.exitClick);
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitClick);
// //
// viewToolStripMenuItem // viewMenuItem
// //
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.viewMenuItem.Index = 1;
this.viewMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.resetMinMaxMenuItem, this.resetMinMaxMenuItem,
this.toolStripMenuItem3, this.MenuItem3,
this.hiddenMenuItem, this.hiddenMenuItem,
this.plotMenuItem, this.plotMenuItem,
this.toolStripMenuItem1, this.MenuItem1,
this.columnsToolStripMenuItem}); this.columnsMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewMenuItem.Text = "View";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); //
this.viewToolStripMenuItem.Text = "View"; // resetMinMaxMenuItem
//
this.resetMinMaxMenuItem.Index = 0;
this.resetMinMaxMenuItem.Text = "Reset Min/Max";
this.resetMinMaxMenuItem.Click += new System.EventHandler(this.resetMinMaxMenuItem_Click);
//
// MenuItem3
//
this.MenuItem3.Index = 1;
this.MenuItem3.Text = "-";
// //
// hiddenMenuItem // hiddenMenuItem
// //
this.hiddenMenuItem.CheckOnClick = true; this.hiddenMenuItem.Index = 2;
this.hiddenMenuItem.Name = "hiddenMenuItem";
this.hiddenMenuItem.Size = new System.Drawing.Size(188, 22);
this.hiddenMenuItem.Text = "Show Hidden Sensors"; this.hiddenMenuItem.Text = "Show Hidden Sensors";
this.hiddenMenuItem.CheckedChanged += new System.EventHandler(this.hiddenSensorsMenuItem_CheckedChanged);
// //
// plotMenuItem // plotMenuItem
// //
this.plotMenuItem.Checked = true; this.plotMenuItem.Index = 3;
this.plotMenuItem.CheckOnClick = true;
this.plotMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.plotMenuItem.Name = "plotMenuItem";
this.plotMenuItem.Size = new System.Drawing.Size(188, 22);
this.plotMenuItem.Text = "Show Plot"; this.plotMenuItem.Text = "Show Plot";
this.plotMenuItem.CheckedChanged += new System.EventHandler(this.plotToolStripMenuItem_CheckedChanged);
// //
// toolStripMenuItem1 // MenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.MenuItem1.Index = 4;
this.toolStripMenuItem1.Size = new System.Drawing.Size(185, 6); this.MenuItem1.Text = "-";
// //
// columnsToolStripMenuItem // columnsMenuItem
// //
this.columnsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.columnsMenuItem.Index = 5;
this.columnsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.valueMenuItem, this.valueMenuItem,
this.minMenuItem, this.minMenuItem,
this.maxMenuItem}); this.maxMenuItem});
this.columnsToolStripMenuItem.Name = "columnsToolStripMenuItem"; this.columnsMenuItem.Text = "Columns";
this.columnsToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.columnsToolStripMenuItem.Text = "Columns";
// //
// valueMenuItem // valueMenuItem
// //
this.valueMenuItem.Checked = true; this.valueMenuItem.Index = 0;
this.valueMenuItem.CheckOnClick = true;
this.valueMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.valueMenuItem.Name = "valueMenuItem";
this.valueMenuItem.Size = new System.Drawing.Size(103, 22);
this.valueMenuItem.Text = "Value"; this.valueMenuItem.Text = "Value";
this.valueMenuItem.CheckedChanged += new System.EventHandler(this.valueMenuItem_CheckedChanged);
// //
// minMenuItem // minMenuItem
// //
this.minMenuItem.Checked = true; this.minMenuItem.Index = 1;
this.minMenuItem.CheckOnClick = true;
this.minMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.minMenuItem.Name = "minMenuItem";
this.minMenuItem.Size = new System.Drawing.Size(103, 22);
this.minMenuItem.Text = "Min"; this.minMenuItem.Text = "Min";
this.minMenuItem.CheckedChanged += new System.EventHandler(this.minMenuItem_CheckedChanged);
// //
// maxMenuItem // maxMenuItem
// //
this.maxMenuItem.Checked = true; this.maxMenuItem.Index = 2;
this.maxMenuItem.CheckOnClick = true;
this.maxMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.maxMenuItem.Name = "maxMenuItem";
this.maxMenuItem.Size = new System.Drawing.Size(103, 22);
this.maxMenuItem.Text = "Max"; this.maxMenuItem.Text = "Max";
this.maxMenuItem.CheckedChanged += new System.EventHandler(this.maxMenuItem_CheckedChanged);
// //
// optionsToolStripMenuItem // optionsMenuItem
// //
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.optionsMenuItem.Index = 2;
this.optionsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.startMinMenuItem, this.startMinMenuItem,
this.minTrayMenuItem, this.minTrayMenuItem,
this.startupMenuItem, this.startupMenuItem,
this.separatorMenuItem, this.separatorMenuItem,
this.temperatureUnitsToolStripMenuItem, this.temperatureUnitsMenuItem,
this.toolStripMenuItem4, this.MenuItem4,
this.hddMenuItem}); this.hddMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsMenuItem.Text = "Options";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
// //
// startMinMenuItem // startMinMenuItem
// //
this.startMinMenuItem.CheckOnClick = true; this.startMinMenuItem.Index = 0;
this.startMinMenuItem.Name = "startMinMenuItem";
this.startMinMenuItem.Size = new System.Drawing.Size(207, 22);
this.startMinMenuItem.Text = "Start Minimized"; this.startMinMenuItem.Text = "Start Minimized";
// //
// minTrayMenuItem // minTrayMenuItem
// //
this.minTrayMenuItem.CheckOnClick = true; this.minTrayMenuItem.Index = 1;
this.minTrayMenuItem.Name = "minTrayMenuItem";
this.minTrayMenuItem.Size = new System.Drawing.Size(207, 22);
this.minTrayMenuItem.Text = "Minimize To Tray"; this.minTrayMenuItem.Text = "Minimize To Tray";
this.minTrayMenuItem.CheckedChanged += new System.EventHandler(this.minTrayMenuItem_CheckedChanged);
// //
// startupMenuItem // startupMenuItem
// //
this.startupMenuItem.CheckOnClick = true; this.startupMenuItem.Index = 2;
this.startupMenuItem.Name = "startupMenuItem";
this.startupMenuItem.Size = new System.Drawing.Size(207, 22);
this.startupMenuItem.Text = "Run On Windows Startup"; this.startupMenuItem.Text = "Run On Windows Startup";
this.startupMenuItem.CheckedChanged += new System.EventHandler(this.runOnWindowsStartupToolStripMenuItem_CheckedChanged);
// //
// separatorMenuItem // separatorMenuItem
// //
this.separatorMenuItem.Name = "separatorMenuItem"; this.separatorMenuItem.Index = 3;
this.separatorMenuItem.Size = new System.Drawing.Size(204, 6); this.separatorMenuItem.Text = "-";
// //
// temperatureUnitsToolStripMenuItem // temperatureUnitsMenuItem
// //
this.temperatureUnitsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.temperatureUnitsMenuItem.Index = 4;
this.celciusToolStripMenuItem, this.temperatureUnitsMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.fahrenheitToolStripMenuItem}); this.celciusMenuItem,
this.temperatureUnitsToolStripMenuItem.Name = "temperatureUnitsToolStripMenuItem"; this.fahrenheitMenuItem});
this.temperatureUnitsToolStripMenuItem.Size = new System.Drawing.Size(207, 22); this.temperatureUnitsMenuItem.Text = "Temperature Unit";
this.temperatureUnitsToolStripMenuItem.Text = "Temperature Unit";
// //
// celciusToolStripMenuItem // celciusMenuItem
// //
this.celciusToolStripMenuItem.Name = "celciusToolStripMenuItem"; this.celciusMenuItem.Index = 0;
this.celciusToolStripMenuItem.Size = new System.Drawing.Size(130, 22); this.celciusMenuItem.Text = "Celcius";
this.celciusToolStripMenuItem.Text = "Celcius"; this.celciusMenuItem.Click += new System.EventHandler(this.celciusMenuItem_Click);
this.celciusToolStripMenuItem.Click += new System.EventHandler(this.celciusToolStripMenuItem_Click);
// //
// fahrenheitToolStripMenuItem // fahrenheitMenuItem
// //
this.fahrenheitToolStripMenuItem.Name = "fahrenheitToolStripMenuItem"; this.fahrenheitMenuItem.Index = 1;
this.fahrenheitToolStripMenuItem.Size = new System.Drawing.Size(130, 22); this.fahrenheitMenuItem.Text = "Fahrenheit";
this.fahrenheitToolStripMenuItem.Text = "Fahrenheit"; this.fahrenheitMenuItem.Click += new System.EventHandler(this.fahrenheitMenuItem_Click);
this.fahrenheitToolStripMenuItem.Click += new System.EventHandler(this.fahrenheitToolStripMenuItem_Click);
// //
// toolStripMenuItem4 // MenuItem4
// //
this.toolStripMenuItem4.Name = "toolStripMenuItem4"; this.MenuItem4.Index = 5;
this.toolStripMenuItem4.Size = new System.Drawing.Size(204, 6); this.MenuItem4.Text = "-";
// //
// hddMenuItem // hddMenuItem
// //
this.hddMenuItem.CheckOnClick = true; this.hddMenuItem.Index = 6;
this.hddMenuItem.Name = "hddMenuItem";
this.hddMenuItem.Size = new System.Drawing.Size(207, 22);
this.hddMenuItem.Text = "Read HDD sensors"; this.hddMenuItem.Text = "Read HDD sensors";
this.hddMenuItem.CheckedChanged += new System.EventHandler(this.hddsensorsToolStripMenuItem_CheckedChanged);
// //
// helpToolStripMenuItem // helpMenuItem
// //
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.helpMenuItem.Index = 3;
this.aboutToolStripMenuItem}); this.helpMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.aboutMenuItem});
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.helpMenuItem.Text = "Help";
this.helpToolStripMenuItem.Text = "Help";
// //
// aboutToolStripMenuItem // aboutMenuItem
// //
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutMenuItem.Index = 0;
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); this.aboutMenuItem.Text = "About";
this.aboutToolStripMenuItem.Text = "About"; this.aboutMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click);
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
// //
// splitContainer // splitContainer
// //
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer.Location = new System.Drawing.Point(12, 12);
this.splitContainer.Location = new System.Drawing.Point(0, 24);
this.splitContainer.Name = "splitContainer"; this.splitContainer.Name = "splitContainer";
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
// //
@@ -448,7 +406,7 @@ namespace OpenHardwareMonitor.GUI {
// //
this.splitContainer.Panel2.Controls.Add(this.plotPanel); this.splitContainer.Panel2.Controls.Add(this.plotPanel);
this.splitContainer.Panel2.Cursor = System.Windows.Forms.Cursors.Default; this.splitContainer.Panel2.Cursor = System.Windows.Forms.Cursors.Default;
this.splitContainer.Size = new System.Drawing.Size(410, 662); this.splitContainer.Size = new System.Drawing.Size(386, 662);
this.splitContainer.SplitterDistance = 488; this.splitContainer.SplitterDistance = 488;
this.splitContainer.SplitterWidth = 3; this.splitContainer.SplitterWidth = 3;
this.splitContainer.TabIndex = 3; this.splitContainer.TabIndex = 3;
@@ -459,14 +417,9 @@ namespace OpenHardwareMonitor.GUI {
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.Location = new System.Drawing.Point(0, 0);
this.plotPanel.Name = "plotPanel"; this.plotPanel.Name = "plotPanel";
this.plotPanel.Size = new System.Drawing.Size(410, 171); this.plotPanel.Size = new System.Drawing.Size(386, 171);
this.plotPanel.TabIndex = 0; this.plotPanel.TabIndex = 0;
// //
// sensorContextMenuStrip
//
this.sensorContextMenuStrip.Name = "sensorContextMenuStrip";
this.sensorContextMenuStrip.Size = new System.Drawing.Size(61, 4);
//
// saveFileDialog // saveFileDialog
// //
this.saveFileDialog.DefaultExt = "txt"; this.saveFileDialog.DefaultExt = "txt";
@@ -480,47 +433,31 @@ namespace OpenHardwareMonitor.GUI {
this.timer.Interval = 1000; this.timer.Interval = 1000;
this.timer.Tick += new System.EventHandler(this.timer_Tick); this.timer.Tick += new System.EventHandler(this.timer_Tick);
// //
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(185, 6);
//
// resetMinMaxMenuItem
//
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 // MainForm
// //
this.Menu = this.mainMenu;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(410, 686); this.ClientSize = new System.Drawing.Size(410, 686);
this.Controls.Add(this.splitContainer); this.Controls.Add(this.splitContainer);
this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip;
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Open Hardware Monitor"; this.Text = "Open Hardware Monitor";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false); this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.ResumeLayout(false); this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private Aga.Controls.Tree.TreeViewAdv treeView; private Aga.Controls.Tree.TreeViewAdv treeView;
private System.Windows.Forms.MenuStrip menuStrip; private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.MenuItem fileMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.MenuItem exitMenuItem;
private Aga.Controls.Tree.TreeColumn sensor; private Aga.Controls.Tree.TreeColumn sensor;
private Aga.Controls.Tree.TreeColumn value; private Aga.Controls.Tree.TreeColumn value;
private Aga.Controls.Tree.TreeColumn min; private Aga.Controls.Tree.TreeColumn min;
@@ -532,35 +469,35 @@ namespace OpenHardwareMonitor.GUI {
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMax; private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxMax;
private System.Windows.Forms.SplitContainer splitContainer; private System.Windows.Forms.SplitContainer splitContainer;
private PlotPanel plotPanel; private PlotPanel plotPanel;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; private System.Windows.Forms.MenuItem viewMenuItem;
private System.Windows.Forms.ToolStripMenuItem plotMenuItem; private System.Windows.Forms.MenuItem plotMenuItem;
private Aga.Controls.Tree.NodeControls.NodeCheckBox nodeCheckBox; private Aga.Controls.Tree.NodeControls.NodeCheckBox nodeCheckBox;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; private System.Windows.Forms.MenuItem helpMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.MenuItem aboutMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveReportToolStripMenuItem; private System.Windows.Forms.MenuItem saveReportMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.MenuItem optionsMenuItem;
private System.Windows.Forms.ToolStripMenuItem hddMenuItem; private System.Windows.Forms.MenuItem hddMenuItem;
private System.Windows.Forms.ToolStripMenuItem minTrayMenuItem; private System.Windows.Forms.MenuItem minTrayMenuItem;
private System.Windows.Forms.ToolStripSeparator separatorMenuItem; private System.Windows.Forms.MenuItem separatorMenuItem;
private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip; private System.Windows.Forms.ContextMenu sensorContextMenu;
private System.Windows.Forms.ToolStripMenuItem startMinMenuItem; private System.Windows.Forms.MenuItem startMinMenuItem;
private System.Windows.Forms.ToolStripMenuItem startupMenuItem; private System.Windows.Forms.MenuItem startupMenuItem;
private System.Windows.Forms.SaveFileDialog saveFileDialog; private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.Timer timer; private System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolStripMenuItem hiddenMenuItem; private System.Windows.Forms.MenuItem hiddenMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; private System.Windows.Forms.MenuItem MenuItem1;
private System.Windows.Forms.ToolStripMenuItem columnsToolStripMenuItem; private System.Windows.Forms.MenuItem columnsMenuItem;
private System.Windows.Forms.ToolStripMenuItem valueMenuItem; private System.Windows.Forms.MenuItem valueMenuItem;
private System.Windows.Forms.ToolStripMenuItem minMenuItem; private System.Windows.Forms.MenuItem minMenuItem;
private System.Windows.Forms.ToolStripMenuItem maxMenuItem; private System.Windows.Forms.MenuItem maxMenuItem;
private System.Windows.Forms.ToolStripMenuItem temperatureUnitsToolStripMenuItem; private System.Windows.Forms.MenuItem temperatureUnitsMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; private System.Windows.Forms.MenuItem MenuItem4;
private System.Windows.Forms.ToolStripMenuItem celciusToolStripMenuItem; private System.Windows.Forms.MenuItem celciusMenuItem;
private System.Windows.Forms.ToolStripMenuItem fahrenheitToolStripMenuItem; private System.Windows.Forms.MenuItem fahrenheitMenuItem;
private System.Windows.Forms.ToolStripMenuItem sumbitReportToolStripMenuItem; private System.Windows.Forms.MenuItem sumbitReportMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; private System.Windows.Forms.MenuItem MenuItem2;
private System.Windows.Forms.ToolStripMenuItem resetMinMaxMenuItem; private System.Windows.Forms.MenuItem resetMinMaxMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3; private System.Windows.Forms.MenuItem MenuItem3;
} }
} }

View File

@@ -61,8 +61,22 @@ namespace OpenHardwareMonitor.GUI {
private StartupManager startupManager = new StartupManager(); private StartupManager startupManager = new StartupManager();
private UpdateVisitor updateVisitor = new UpdateVisitor(); private UpdateVisitor updateVisitor = new UpdateVisitor();
private UserOption showHiddenSensors;
private UserOption showPlot;
private UserOption showValue;
private UserOption showMin;
private UserOption showMax;
private UserOption startMinimized;
private UserOption minimizeToTray;
private UserOption autoStart;
private UserOption readHddSensors;
public MainForm() { public MainForm() {
InitializeComponent(); InitializeComponent();
// set the DockStyle here, to avoid conflicts with the MainMenu
this.splitContainer.Dock = DockStyle.Fill;
this.Font = SystemFonts.MessageBoxFont; this.Font = SystemFonts.MessageBoxFont;
treeView.Font = SystemFonts.MessageBoxFont; treeView.Font = SystemFonts.MessageBoxFont;
plotPanel.Font = SystemFonts.MessageBoxFont; plotPanel.Font = SystemFonts.MessageBoxFont;
@@ -85,8 +99,9 @@ namespace OpenHardwareMonitor.GUI {
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
} }
Width = Utilities.Config.Get("mainForm.Width", Width); ClientSize = new Size(
Height = Utilities.Config.Get("mainForm.Height", Height); Utilities.Config.Get("mainForm.Width", ClientSize.Width),
Utilities.Config.Get("mainForm.Height", ClientSize.Height));
foreach (TreeColumn column in treeView.Columns) foreach (TreeColumn column in treeView.Columns)
column.Width = Math.Max(20, Math.Min(400, column.Width = Math.Max(20, Math.Min(400,
@@ -125,21 +140,53 @@ namespace OpenHardwareMonitor.GUI {
plotColorPalette[11] = Color.Olive; plotColorPalette[11] = Color.Olive;
plotColorPalette[12] = Color.Firebrick; plotColorPalette[12] = Color.Firebrick;
hiddenMenuItem.Checked = Config.Get(hiddenMenuItem.Name, false); showHiddenSensors = new UserOption("hiddenMenuItem", false, hiddenMenuItem);
plotMenuItem.Checked = Config.Get(plotMenuItem.Name, false); showHiddenSensors.Changed += delegate(object sender, EventArgs e) {
treeModel.ForceVisible = showHiddenSensors.Value;
};
valueMenuItem.Checked = Config.Get(valueMenuItem.Name, true); showPlot = new UserOption("plotMenuItem", false, plotMenuItem);
minMenuItem.Checked = Config.Get(minMenuItem.Name, false); showPlot.Changed += delegate(object sender, EventArgs e) {
maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true); splitContainer.Panel2Collapsed = !showPlot.Value;
treeView.Invalidate();
};
startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); showValue = new UserOption("valueMenuItem", true, valueMenuItem);
minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true); showValue.Changed += delegate(object sender, EventArgs e) {
startupMenuItem.Checked = startupManager.Startup; treeView.Columns[1].IsVisible = showValue.Value;
hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true); };
celciusToolStripMenuItem.Checked = showMin = new UserOption("minMenuItem", false, minMenuItem);
showMin.Changed += delegate(object sender, EventArgs e) {
treeView.Columns[2].IsVisible = showMin.Value;
};
showMax = new UserOption("maxMenuItem", true, maxMenuItem);
showMax.Changed += delegate(object sender, EventArgs e) {
treeView.Columns[3].IsVisible = showMax.Value;
};
startMinimized = new UserOption("startMinMenuItem", false, startMinMenuItem);
minimizeToTray = new UserOption("minTrayMenuItem", true, minTrayMenuItem);
minimizeToTray.Changed += delegate(object sender, EventArgs e) {
systemTray.IsMainIconEnabled = minimizeToTray.Value;
};
autoStart = new UserOption(null, startupManager.Startup, startupMenuItem);
autoStart.Changed += delegate(object sender, EventArgs e) {
startupManager.Startup = autoStart.Value; ;
};
readHddSensors = new UserOption("hddMenuItem", true, hddMenuItem);
readHddSensors.Changed += delegate(object sender, EventArgs e) {
computer.HDDEnabled = readHddSensors.Value;
UpdatePlotSelection(null, null);
};
celciusMenuItem.Checked =
UnitManager.TemperatureUnit == TemperatureUnit.Celcius; UnitManager.TemperatureUnit == TemperatureUnit.Celcius;
fahrenheitToolStripMenuItem.Checked = !celciusToolStripMenuItem.Checked; fahrenheitMenuItem.Checked = !celciusMenuItem.Checked;
startupMenuItem.Visible = startupManager.IsAvailable; startupMenuItem.Visible = startupManager.IsAvailable;
@@ -250,22 +297,11 @@ namespace OpenHardwareMonitor.GUI {
} }
private void SaveConfiguration() { private void SaveConfiguration() {
Config.Set(hiddenMenuItem.Name, hiddenMenuItem.Checked);
Config.Set(plotMenuItem.Name, plotMenuItem.Checked);
Config.Set(valueMenuItem.Name, valueMenuItem.Checked);
Config.Set(minMenuItem.Name, minMenuItem.Checked);
Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
if (WindowState != FormWindowState.Minimized) { if (WindowState != FormWindowState.Minimized) {
Config.Set("mainForm.Location.X", Location.X); Config.Set("mainForm.Location.X", Location.X);
Config.Set("mainForm.Location.Y", Location.Y); Config.Set("mainForm.Location.Y", Location.Y);
Config.Set("mainForm.Width", Width); Config.Set("mainForm.Width", ClientSize.Width);
Config.Set("mainForm.Height", Height); Config.Set("mainForm.Height", ClientSize.Height);
} }
foreach (TreeColumn column in treeView.Columns) foreach (TreeColumn column in treeView.Columns)
@@ -276,6 +312,7 @@ namespace OpenHardwareMonitor.GUI {
} }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { private void MainForm_FormClosed(object sender, FormClosedEventArgs e) {
Visible = false;
SaveConfiguration(); SaveConfiguration();
timer.Enabled = false; timer.Enabled = false;
@@ -283,17 +320,10 @@ namespace OpenHardwareMonitor.GUI {
computer.Close(); computer.Close();
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { private void aboutMenuItem_Click(object sender, EventArgs e) {
new AboutBox().ShowDialog(); new AboutBox().ShowDialog();
} }
private void plotToolStripMenuItem_CheckedChanged(object sender,
EventArgs e)
{
splitContainer.Panel2Collapsed = !plotMenuItem.Checked;
treeView.Invalidate();
}
private void treeView_Click(object sender, EventArgs e) { private void treeView_Click(object sender, EventArgs e) {
MouseEventArgs m = e as MouseEventArgs; MouseEventArgs m = e as MouseEventArgs;
@@ -301,58 +331,57 @@ namespace OpenHardwareMonitor.GUI {
return; return;
NodeControlInfo info = treeView.GetNodeControlInfoAt(new Point(m.X, m.Y)); NodeControlInfo info = treeView.GetNodeControlInfoAt(new Point(m.X, m.Y));
if (info.Control != null) { treeView.SelectedNode = info.Node;
if (info.Node != null) {
SensorNode node = info.Node.Tag as SensorNode; SensorNode node = info.Node.Tag as SensorNode;
if (node != null && node.Sensor != null) { if (node != null && node.Sensor != null) {
sensorContextMenu.MenuItems.Clear();
sensorContextMenuStrip.Items.Clear();
if (node.Sensor.Parameters.Length > 0) { if (node.Sensor.Parameters.Length > 0) {
ToolStripMenuItem item = new ToolStripMenuItem("Parameters..."); MenuItem item = new MenuItem("Parameters...");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
ShowParameterForm(node.Sensor); ShowParameterForm(node.Sensor);
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} }
EditableControl control = info.Control as EditableControl; if (nodeTextBoxText.EditEnabled) {
if (control != null) { MenuItem item = new MenuItem("Rename");
ToolStripMenuItem item = new ToolStripMenuItem("Rename");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
control.BeginEdit(); nodeTextBoxText.BeginEdit();
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} }
if (node.IsVisible) { if (node.IsVisible) {
ToolStripMenuItem item = new ToolStripMenuItem("Hide"); MenuItem item = new MenuItem("Hide");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
node.IsVisible = false; node.IsVisible = false;
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} else { } else {
ToolStripMenuItem item = new ToolStripMenuItem("Unhide"); MenuItem item = new MenuItem("Unhide");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
node.IsVisible = true; node.IsVisible = true;
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} }
if (systemTray.Contains(node.Sensor)) { if (systemTray.Contains(node.Sensor)) {
ToolStripMenuItem item = new ToolStripMenuItem("Remove From Tray"); MenuItem item = new MenuItem("Remove From Tray");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
systemTray.Remove(node.Sensor); systemTray.Remove(node.Sensor);
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} else { } else {
ToolStripMenuItem item = new ToolStripMenuItem("Add To Tray"); MenuItem item = new MenuItem("Add To Tray");
item.Click += delegate(object obj, EventArgs args) { item.Click += delegate(object obj, EventArgs args) {
systemTray.Add(node.Sensor, true); systemTray.Add(node.Sensor, true);
}; };
sensorContextMenuStrip.Items.Add(item); sensorContextMenu.MenuItems.Add(item);
} }
sensorContextMenuStrip.Show(treeView, m.X, m.Y); sensorContextMenu.Show(treeView, new Point(m.X, m.Y));
} }
} }
} }
private void saveReportToolStripMenuItem_Click(object sender, EventArgs e) { private void saveReportMenuItem_Click(object sender, EventArgs e) {
string report = computer.GetReport(); string report = computer.GetReport();
if (saveFileDialog.ShowDialog() == DialogResult.OK) { if (saveFileDialog.ShowDialog() == DialogResult.OK) {
using (TextWriter w = new StreamWriter(saveFileDialog.FileName)) { using (TextWriter w = new StreamWriter(saveFileDialog.FileName)) {
@@ -361,13 +390,6 @@ namespace OpenHardwareMonitor.GUI {
} }
} }
private void hddsensorsToolStripMenuItem_CheckedChanged(object sender,
EventArgs e)
{
computer.HDDEnabled = hddMenuItem.Checked;
UpdatePlotSelection(null, null);
}
private void SysTrayHideShow() { private void SysTrayHideShow() {
Visible = !Visible; Visible = !Visible;
if (Visible) if (Visible)
@@ -377,7 +399,7 @@ namespace OpenHardwareMonitor.GUI {
protected override void WndProc(ref Message m) { protected override void WndProc(ref Message m) {
const int WM_SYSCOMMAND = 0x112; const int WM_SYSCOMMAND = 0x112;
const int SC_MINIMIZE = 0xF020; const int SC_MINIMIZE = 0xF020;
if (minTrayMenuItem.Checked && if (minimizeToTray.Value &&
m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_MINIMIZE) { m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_MINIMIZE) {
SysTrayHideShow(); SysTrayHideShow();
} else { } else {
@@ -389,12 +411,12 @@ namespace OpenHardwareMonitor.GUI {
SysTrayHideShow(); SysTrayHideShow();
} }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { private void removeMenuItem_Click(object sender, EventArgs e) {
ToolStripMenuItem item = sender as ToolStripMenuItem; MenuItem item = sender as MenuItem;
if (item == null) if (item == null)
return; return;
ISensor sensor = item.Owner.Tag as ISensor; ISensor sensor = item.Parent.Tag as ISensor;
if (sensor == null) if (sensor == null)
return; return;
@@ -417,46 +439,19 @@ namespace OpenHardwareMonitor.GUI {
} }
} }
private void runOnWindowsStartupToolStripMenuItem_CheckedChanged( private void celciusMenuItem_Click(object sender, EventArgs e) {
object sender, EventArgs e) celciusMenuItem.Checked = true;
{ fahrenheitMenuItem.Checked = false;
startupManager.Startup = startupMenuItem.Checked;
}
private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) {
systemTray.IsMainIconEnabled = minTrayMenuItem.Checked;
}
private void hiddenSensorsMenuItem_CheckedChanged(object sender,
EventArgs e) {
treeModel.ForceVisible = hiddenMenuItem.Checked;
}
private void valueMenuItem_CheckedChanged(object sender, EventArgs e) {
treeView.Columns[1].IsVisible = valueMenuItem.Checked;
}
private void minMenuItem_CheckedChanged(object sender, EventArgs e) {
treeView.Columns[2].IsVisible = minMenuItem.Checked;
}
private void maxMenuItem_CheckedChanged(object sender, EventArgs e) {
treeView.Columns[3].IsVisible = maxMenuItem.Checked;
}
private void celciusToolStripMenuItem_Click(object sender, EventArgs e) {
celciusToolStripMenuItem.Checked = true;
fahrenheitToolStripMenuItem.Checked = false;
UnitManager.TemperatureUnit = TemperatureUnit.Celcius; UnitManager.TemperatureUnit = TemperatureUnit.Celcius;
} }
private void fahrenheitToolStripMenuItem_Click(object sender, EventArgs e) { private void fahrenheitMenuItem_Click(object sender, EventArgs e) {
celciusToolStripMenuItem.Checked = false; celciusMenuItem.Checked = false;
fahrenheitToolStripMenuItem.Checked = true; fahrenheitMenuItem.Checked = true;
UnitManager.TemperatureUnit = TemperatureUnit.Fahrenheit; UnitManager.TemperatureUnit = TemperatureUnit.Fahrenheit;
} }
private void sumbitReportToolStripMenuItem_Click(object sender, EventArgs e) private void sumbitReportMenuItem_Click(object sender, EventArgs e)
{ {
ReportForm form = new ReportForm(); ReportForm form = new ReportForm();
form.Report = computer.GetReport(); form.Report = computer.GetReport();

View File

@@ -117,20 +117,17 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>226, 17</value>
</metadata> </metadata>
<metadata name="sensorContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="sensorContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>125, 17</value> <value>334, 17</value>
</metadata> </metadata>
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>311, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 17</value> <value>146, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>55</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <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"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@@ -77,19 +77,19 @@ namespace OpenHardwareMonitor.GUI {
this.pen = new Pen(Color.FromArgb(96, Color.Black)); this.pen = new Pen(Color.FromArgb(96, Color.Black));
this.font = SystemFonts.MessageBoxFont; this.font = SystemFonts.MessageBoxFont;
ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); ContextMenu contextMenu = new ContextMenu();
ToolStripMenuItem hideShowItem = new ToolStripMenuItem("Hide/Show"); MenuItem hideShowItem = new MenuItem("Hide/Show");
hideShowItem.Click += delegate(object obj, EventArgs args) { hideShowItem.Click += delegate(object obj, EventArgs args) {
sensorSystemTray.SendHideShowCommand(); sensorSystemTray.SendHideShowCommand();
}; };
contextMenuStrip.Items.Add(hideShowItem); contextMenu.MenuItems.Add(hideShowItem);
contextMenuStrip.Items.Add(new ToolStripSeparator()); contextMenu.MenuItems.Add(new MenuItem("-"));
ToolStripMenuItem removeItem = new ToolStripMenuItem("Remove Sensor"); MenuItem removeItem = new MenuItem("Remove Sensor");
removeItem.Click += delegate(object obj, EventArgs args) { removeItem.Click += delegate(object obj, EventArgs args) {
sensorSystemTray.Remove(this.sensor); sensorSystemTray.Remove(this.sensor);
}; };
contextMenuStrip.Items.Add(removeItem); contextMenu.MenuItems.Add(removeItem);
ToolStripMenuItem colorItem = new ToolStripMenuItem("Change Color..."); MenuItem colorItem = new MenuItem("Change Color...");
colorItem.Click += delegate(object obj, EventArgs args) { colorItem.Click += delegate(object obj, EventArgs args) {
ColorDialog dialog = new ColorDialog(); ColorDialog dialog = new ColorDialog();
dialog.Color = Color; dialog.Color = Color;
@@ -99,14 +99,14 @@ namespace OpenHardwareMonitor.GUI {
"traycolor").ToString(), Color); "traycolor").ToString(), Color);
} }
}; };
contextMenuStrip.Items.Add(colorItem); contextMenu.MenuItems.Add(colorItem);
contextMenuStrip.Items.Add(new ToolStripSeparator()); contextMenu.MenuItems.Add(new MenuItem("-"));
ToolStripMenuItem exitItem = new ToolStripMenuItem("Exit"); MenuItem exitItem = new MenuItem("Exit");
exitItem.Click += delegate(object obj, EventArgs args) { exitItem.Click += delegate(object obj, EventArgs args) {
sensorSystemTray.SendExitCommand(); sensorSystemTray.SendExitCommand();
}; };
contextMenuStrip.Items.Add(exitItem); contextMenu.MenuItems.Add(exitItem);
this.notifyIcon.ContextMenuStrip = contextMenuStrip; this.notifyIcon.ContextMenu = contextMenu;
this.notifyIcon.DoubleClick += delegate(object obj, EventArgs args) { this.notifyIcon.DoubleClick += delegate(object obj, EventArgs args) {
sensorSystemTray.SendHideShowCommand(); sensorSystemTray.SendHideShowCommand();
}; };

View File

@@ -57,19 +57,19 @@ namespace OpenHardwareMonitor.GUI {
this.mainIcon = new NotifyIcon(); this.mainIcon = new NotifyIcon();
ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); ContextMenu contextMenu = new ContextMenu();
ToolStripMenuItem hideShowItem = new ToolStripMenuItem("Hide/Show"); MenuItem hideShowItem = new MenuItem("Hide/Show");
hideShowItem.Click += delegate(object obj, EventArgs args) { hideShowItem.Click += delegate(object obj, EventArgs args) {
SendHideShowCommand(); SendHideShowCommand();
}; };
contextMenuStrip.Items.Add(hideShowItem); contextMenu.MenuItems.Add(hideShowItem);
contextMenuStrip.Items.Add(new ToolStripSeparator()); contextMenu.MenuItems.Add(new MenuItem("-"));
ToolStripMenuItem exitItem = new ToolStripMenuItem("Exit"); MenuItem exitItem = new MenuItem("Exit");
exitItem.Click += delegate(object obj, EventArgs args) { exitItem.Click += delegate(object obj, EventArgs args) {
SendExitCommand(); SendExitCommand();
}; };
contextMenuStrip.Items.Add(exitItem); contextMenu.MenuItems.Add(exitItem);
this.mainIcon.ContextMenuStrip = contextMenuStrip; this.mainIcon.ContextMenu = contextMenu;
this.mainIcon.DoubleClick += delegate(object obj, EventArgs args) { this.mainIcon.DoubleClick += delegate(object obj, EventArgs args) {
SendHideShowCommand(); SendHideShowCommand();
}; };

92
GUI/UserOption.cs Normal file
View File

@@ -0,0 +1,92 @@
/*
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 <m.moeller@gmx.ch>.
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 System.Windows.Forms;
using OpenHardwareMonitor.Utilities;
namespace OpenHardwareMonitor.GUI {
public class UserOption {
private string name;
private bool value;
private MenuItem menuItem;
private event EventHandler changed;
public UserOption(string name, bool value,
MenuItem menuItem) {
this.name = name;
if (name != null)
this.value = Config.Get(name, value);
else
this.value = value;
this.menuItem = menuItem;
this.menuItem.Checked = this.value;
this.menuItem.Click += new EventHandler(menuItem_Click);
}
private void menuItem_Click(object sender, EventArgs e) {
this.Value = !this.Value;
}
public bool Value {
get { return value; }
set {
if (this.value != value) {
this.value = value;
if (this.name != null)
Config.Set(name, value);
this.menuItem.Checked = value;
if (changed != null)
changed(this, null);
}
}
}
public event EventHandler Changed {
add {
changed += value;
if (changed != null)
changed(this, null);
}
remove {
changed -= value;
}
}
}
}

View File

@@ -89,6 +89,7 @@
<Compile Include="GUI\TypeNode.cs" /> <Compile Include="GUI\TypeNode.cs" />
<Compile Include="GUI\UnitManager.cs" /> <Compile Include="GUI\UnitManager.cs" />
<Compile Include="GUI\UpdateVisitor.cs" /> <Compile Include="GUI\UpdateVisitor.cs" />
<Compile Include="GUI\UserOption.cs" />
<Compile Include="Hardware\CPU\AMD10CPU.cs" /> <Compile Include="Hardware\CPU\AMD10CPU.cs" />
<Compile Include="Hardware\CPU\AMD0FCPU.cs" /> <Compile Include="Hardware\CPU\AMD0FCPU.cs" />
<Compile Include="Hardware\CPU\CPUID.cs" /> <Compile Include="Hardware\CPU\CPUID.cs" />
@@ -169,10 +170,6 @@
<DependentUpon>AboutBox.cs</DependentUpon> <DependentUpon>AboutBox.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="GUI\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="GUI\PlotPanel.resx"> <EmbeddedResource Include="GUI\PlotPanel.resx">
<DependentUpon>PlotPanel.cs</DependentUpon> <DependentUpon>PlotPanel.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -213,6 +210,9 @@
<EmbeddedResource Include="Resources\mainboard.png" /> <EmbeddedResource Include="Resources\mainboard.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="GUI\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\ReportForm.resx"> <EmbeddedResource Include="GUI\ReportForm.resx">
<DependentUpon>ReportForm.cs</DependentUpon> <DependentUpon>ReportForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.37.1")] [assembly: AssemblyVersion("0.1.37.2")]
[assembly: AssemblyFileVersion("0.1.37.1")] [assembly: AssemblyFileVersion("0.1.37.2")]