Added a user interface to configure certain sensors as hidden. This fixed Issue 53.
authormoel.mich
Fri, 14 May 2010 22:30:06 +0000
changeset 1112b8a8cf92c3a
parent 110 411b72b73d8f
child 112 69d29f1a2307
Added a user interface to configure certain sensors as hidden. This fixed Issue 53.
GUI/HardwareNode.cs
GUI/MainForm.Designer.cs
GUI/MainForm.cs
GUI/MainForm.resx
GUI/Node.cs
GUI/SensorNode.cs
GUI/SensorProperties.cs
GUI/TreeModel.cs
GUI/TypeNode.cs
OpenHardwareMonitor.csproj
     1.1 --- a/GUI/HardwareNode.cs	Sun May 09 16:22:13 2010 +0000
     1.2 +++ b/GUI/HardwareNode.cs	Fri May 14 22:30:06 2010 +0000
     1.3 @@ -38,7 +38,6 @@
     1.4  using System;
     1.5  using System.Collections.Generic;
     1.6  using System.Drawing;
     1.7 -using Aga.Controls.Tree;
     1.8  using OpenHardwareMonitor.Hardware;
     1.9  
    1.10  namespace OpenHardwareMonitor.GUI {
    1.11 @@ -71,16 +70,8 @@
    1.12        get { return hardware; }
    1.13      }
    1.14  
    1.15 -    public void SetVisible(SensorType sensorType, bool visible) {
    1.16 -      foreach (TypeNode node in typeNodes)
    1.17 -        if (node.SensorType == sensorType) {
    1.18 -          node.IsVisible = visible;
    1.19 -          UpdateNode(node);
    1.20 -        }
    1.21 -    }
    1.22 -
    1.23 -    private void UpdateNode(TypeNode node) {      
    1.24 -      if (node.IsVisible && node.Nodes.Count > 0) {
    1.25 +    private void UpdateNode(TypeNode node) {  
    1.26 +      if (node.Nodes.Count > 0) {
    1.27          if (!Nodes.Contains(node)) {
    1.28            int i = 0;
    1.29            while (i < Nodes.Count &&
    1.30 @@ -95,10 +86,16 @@
    1.31      }
    1.32  
    1.33      private void SensorRemoved(ISensor sensor) {
    1.34 -      foreach (TypeNode node in typeNodes)
    1.35 -        if (node.SensorType == sensor.SensorType) {
    1.36 -          node.Nodes.Remove(new SensorNode(sensor));
    1.37 -          UpdateNode(node);
    1.38 +      foreach (TypeNode typeNode in typeNodes)
    1.39 +        if (typeNode.SensorType == sensor.SensorType) { 
    1.40 +          SensorNode sensorNode = null;
    1.41 +          foreach (Node node in typeNode.Nodes) {
    1.42 +            SensorNode n = node as SensorNode;
    1.43 +            if (n != null && n.Sensor == sensor)
    1.44 +              sensorNode = n;
    1.45 +          }
    1.46 +          typeNode.Nodes.Remove(sensorNode);
    1.47 +          UpdateNode(typeNode);
    1.48          }
    1.49      }
    1.50  
    1.51 @@ -107,15 +104,16 @@
    1.52        while (i < node.Nodes.Count &&
    1.53          ((SensorNode)node.Nodes[i]).Sensor.Index < sensor.Index)
    1.54          i++;
    1.55 -      node.Nodes.Insert(i, new SensorNode(sensor));        
    1.56 +      SensorNode sensorNode = new SensorNode(sensor);
    1.57 +      node.Nodes.Insert(i, sensorNode);
    1.58      }
    1.59  
    1.60      private void SensorAdded(ISensor sensor) {
    1.61 -      foreach (TypeNode node in typeNodes)
    1.62 -        if (node.SensorType == sensor.SensorType) {
    1.63 -          InsertSorted(node, sensor);
    1.64 -          UpdateNode(node);
    1.65 +      foreach (TypeNode typeNode in typeNodes)
    1.66 +        if (typeNode.SensorType == sensor.SensorType) {
    1.67 +          InsertSorted(typeNode, sensor);
    1.68 +          UpdateNode(typeNode);          
    1.69          }
    1.70 -    }
    1.71 +    }    
    1.72    }
    1.73  }
     2.1 --- a/GUI/MainForm.Designer.cs	Sun May 09 16:22:13 2010 +0000
     2.2 +++ b/GUI/MainForm.Designer.cs	Fri May 14 22:30:06 2010 +0000
     2.3 @@ -75,25 +75,19 @@
     2.4        this.nodeTextBoxMin = new Aga.Controls.Tree.NodeControls.NodeTextBox();
     2.5        this.nodeTextBoxMax = new Aga.Controls.Tree.NodeControls.NodeTextBox();
     2.6        this.nodeTextBoxLimit = new Aga.Controls.Tree.NodeControls.NodeTextBox();
     2.7 -      this.columnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     2.8 -      this.valueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     2.9 -      this.minMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.10 -      this.maxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.11 -      this.limitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.12        this.menuStrip = new System.Windows.Forms.MenuStrip();
    2.13        this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.14        this.saveReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.15        this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.16        this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.17 -      this.sensorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.18 -      this.voltMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.19 -      this.clocksMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.20 -      this.tempMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.21 -      this.loadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.22 -      this.fansMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.23 -      this.flowsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.24 +      this.hiddenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.25 +      this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.26        this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
    2.27 -      this.plotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.28 +      this.columnsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.29 +      this.valueMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.30 +      this.minMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.31 +      this.maxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.32 +      this.limitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.33        this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.34        this.startMinMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.35        this.minTrayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    2.36 @@ -111,7 +105,6 @@
    2.37        this.sensorContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    2.38        this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    2.39        this.timer = new System.Windows.Forms.Timer(this.components);
    2.40 -      this.columnsContextMenuStrip.SuspendLayout();
    2.41        this.menuStrip.SuspendLayout();
    2.42        this.splitContainer.Panel1.SuspendLayout();
    2.43        this.splitContainer.Panel2.SuspendLayout();
    2.44 @@ -239,56 +232,6 @@
    2.45        this.nodeTextBoxLimit.LeftMargin = 3;
    2.46        this.nodeTextBoxLimit.ParentColumn = this.limit;
    2.47        // 
    2.48 -      // columnsContextMenuStrip
    2.49 -      // 
    2.50 -      this.columnsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    2.51 -            this.valueToolStripMenuItem,
    2.52 -            this.minMenuItem,
    2.53 -            this.maxMenuItem,
    2.54 -            this.limitMenuItem});
    2.55 -      this.columnsContextMenuStrip.Name = "columnsContextMenuStrip";
    2.56 -      this.columnsContextMenuStrip.Size = new System.Drawing.Size(104, 92);
    2.57 -      // 
    2.58 -      // valueToolStripMenuItem
    2.59 -      // 
    2.60 -      this.valueToolStripMenuItem.Checked = true;
    2.61 -      this.valueToolStripMenuItem.CheckOnClick = true;
    2.62 -      this.valueToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.63 -      this.valueToolStripMenuItem.Name = "valueToolStripMenuItem";
    2.64 -      this.valueToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
    2.65 -      this.valueToolStripMenuItem.Text = "Value";
    2.66 -      this.valueToolStripMenuItem.CheckedChanged += new System.EventHandler(this.valueToolStripMenuItem_CheckedChanged);
    2.67 -      // 
    2.68 -      // minMenuItem
    2.69 -      // 
    2.70 -      this.minMenuItem.Checked = true;
    2.71 -      this.minMenuItem.CheckOnClick = true;
    2.72 -      this.minMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.73 -      this.minMenuItem.Name = "minMenuItem";
    2.74 -      this.minMenuItem.Size = new System.Drawing.Size(103, 22);
    2.75 -      this.minMenuItem.Text = "Min";
    2.76 -      this.minMenuItem.CheckedChanged += new System.EventHandler(this.minToolStripMenuItem_CheckedChanged);
    2.77 -      // 
    2.78 -      // maxMenuItem
    2.79 -      // 
    2.80 -      this.maxMenuItem.Checked = true;
    2.81 -      this.maxMenuItem.CheckOnClick = true;
    2.82 -      this.maxMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.83 -      this.maxMenuItem.Name = "maxMenuItem";
    2.84 -      this.maxMenuItem.Size = new System.Drawing.Size(103, 22);
    2.85 -      this.maxMenuItem.Text = "Max";
    2.86 -      this.maxMenuItem.CheckedChanged += new System.EventHandler(this.maxToolStripMenuItem_CheckedChanged);
    2.87 -      // 
    2.88 -      // limitMenuItem
    2.89 -      // 
    2.90 -      this.limitMenuItem.Checked = true;
    2.91 -      this.limitMenuItem.CheckOnClick = true;
    2.92 -      this.limitMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
    2.93 -      this.limitMenuItem.Name = "limitMenuItem";
    2.94 -      this.limitMenuItem.Size = new System.Drawing.Size(103, 22);
    2.95 -      this.limitMenuItem.Text = "Limit";
    2.96 -      this.limitMenuItem.CheckedChanged += new System.EventHandler(this.limitToolStripMenuItem_CheckedChanged);
    2.97 -      // 
    2.98        // menuStrip
    2.99        // 
   2.100        this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
   2.101 @@ -329,90 +272,21 @@
   2.102        // viewToolStripMenuItem
   2.103        // 
   2.104        this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
   2.105 -            this.sensorsToolStripMenuItem,
   2.106 +            this.hiddenMenuItem,
   2.107 +            this.plotMenuItem,
   2.108              this.toolStripMenuItem1,
   2.109 -            this.plotMenuItem});
   2.110 +            this.columnsToolStripMenuItem});
   2.111        this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
   2.112        this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
   2.113        this.viewToolStripMenuItem.Text = "View";
   2.114        // 
   2.115 -      // sensorsToolStripMenuItem
   2.116 +      // hiddenMenuItem
   2.117        // 
   2.118 -      this.sensorsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
   2.119 -            this.voltMenuItem,
   2.120 -            this.clocksMenuItem,
   2.121 -            this.tempMenuItem,
   2.122 -            this.loadMenuItem,
   2.123 -            this.fansMenuItem,
   2.124 -            this.flowsMenuItem});
   2.125 -      this.sensorsToolStripMenuItem.Name = "sensorsToolStripMenuItem";
   2.126 -      this.sensorsToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
   2.127 -      this.sensorsToolStripMenuItem.Text = "Sensors";
   2.128 -      // 
   2.129 -      // voltMenuItem
   2.130 -      // 
   2.131 -      this.voltMenuItem.Checked = true;
   2.132 -      this.voltMenuItem.CheckOnClick = true;
   2.133 -      this.voltMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.134 -      this.voltMenuItem.Name = "voltMenuItem";
   2.135 -      this.voltMenuItem.Size = new System.Drawing.Size(147, 22);
   2.136 -      this.voltMenuItem.Text = "Voltages";
   2.137 -      this.voltMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.138 -      // 
   2.139 -      // clocksMenuItem
   2.140 -      // 
   2.141 -      this.clocksMenuItem.Checked = true;
   2.142 -      this.clocksMenuItem.CheckOnClick = true;
   2.143 -      this.clocksMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.144 -      this.clocksMenuItem.Name = "clocksMenuItem";
   2.145 -      this.clocksMenuItem.Size = new System.Drawing.Size(147, 22);
   2.146 -      this.clocksMenuItem.Text = "Clocks";
   2.147 -      this.clocksMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.148 -      // 
   2.149 -      // tempMenuItem
   2.150 -      // 
   2.151 -      this.tempMenuItem.Checked = true;
   2.152 -      this.tempMenuItem.CheckOnClick = true;
   2.153 -      this.tempMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.154 -      this.tempMenuItem.Name = "tempMenuItem";
   2.155 -      this.tempMenuItem.Size = new System.Drawing.Size(147, 22);
   2.156 -      this.tempMenuItem.Text = "Temperatures";
   2.157 -      this.tempMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.158 -      // 
   2.159 -      // loadMenuItem
   2.160 -      // 
   2.161 -      this.loadMenuItem.Checked = true;
   2.162 -      this.loadMenuItem.CheckOnClick = true;
   2.163 -      this.loadMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.164 -      this.loadMenuItem.Name = "loadMenuItem";
   2.165 -      this.loadMenuItem.Size = new System.Drawing.Size(147, 22);
   2.166 -      this.loadMenuItem.Text = "Load";
   2.167 -      this.loadMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.168 -      // 
   2.169 -      // fansMenuItem
   2.170 -      // 
   2.171 -      this.fansMenuItem.Checked = true;
   2.172 -      this.fansMenuItem.CheckOnClick = true;
   2.173 -      this.fansMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.174 -      this.fansMenuItem.Name = "fansMenuItem";
   2.175 -      this.fansMenuItem.Size = new System.Drawing.Size(147, 22);
   2.176 -      this.fansMenuItem.Text = "Fans";
   2.177 -      this.fansMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.178 -      // 
   2.179 -      // flowsMenuItem
   2.180 -      // 
   2.181 -      this.flowsMenuItem.Checked = true;
   2.182 -      this.flowsMenuItem.CheckOnClick = true;
   2.183 -      this.flowsMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.184 -      this.flowsMenuItem.Name = "flowsMenuItem";
   2.185 -      this.flowsMenuItem.Size = new System.Drawing.Size(147, 22);
   2.186 -      this.flowsMenuItem.Text = "Flows";
   2.187 -      this.flowsMenuItem.CheckedChanged += new System.EventHandler(this.UpdateSensorTypeChecked);
   2.188 -      // 
   2.189 -      // toolStripMenuItem1
   2.190 -      // 
   2.191 -      this.toolStripMenuItem1.Name = "toolStripMenuItem1";
   2.192 -      this.toolStripMenuItem1.Size = new System.Drawing.Size(111, 6);
   2.193 +      this.hiddenMenuItem.CheckOnClick = true;
   2.194 +      this.hiddenMenuItem.Name = "hiddenMenuItem";
   2.195 +      this.hiddenMenuItem.Size = new System.Drawing.Size(188, 22);
   2.196 +      this.hiddenMenuItem.Text = "Show Hidden Sensors";
   2.197 +      this.hiddenMenuItem.CheckedChanged += new System.EventHandler(this.hiddenSensorsMenuItem_CheckedChanged);
   2.198        // 
   2.199        // plotMenuItem
   2.200        // 
   2.201 @@ -420,10 +294,66 @@
   2.202        this.plotMenuItem.CheckOnClick = true;
   2.203        this.plotMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.204        this.plotMenuItem.Name = "plotMenuItem";
   2.205 -      this.plotMenuItem.Size = new System.Drawing.Size(114, 22);
   2.206 -      this.plotMenuItem.Text = "Plot";
   2.207 +      this.plotMenuItem.Size = new System.Drawing.Size(188, 22);
   2.208 +      this.plotMenuItem.Text = "Show Plot";
   2.209        this.plotMenuItem.CheckedChanged += new System.EventHandler(this.plotToolStripMenuItem_CheckedChanged);
   2.210        // 
   2.211 +      // toolStripMenuItem1
   2.212 +      // 
   2.213 +      this.toolStripMenuItem1.Name = "toolStripMenuItem1";
   2.214 +      this.toolStripMenuItem1.Size = new System.Drawing.Size(185, 6);
   2.215 +      // 
   2.216 +      // columnsToolStripMenuItem
   2.217 +      // 
   2.218 +      this.columnsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
   2.219 +            this.valueMenuItem,
   2.220 +            this.minMenuItem,
   2.221 +            this.maxMenuItem,
   2.222 +            this.limitMenuItem});
   2.223 +      this.columnsToolStripMenuItem.Name = "columnsToolStripMenuItem";
   2.224 +      this.columnsToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
   2.225 +      this.columnsToolStripMenuItem.Text = "Columns";
   2.226 +      // 
   2.227 +      // valueMenuItem
   2.228 +      // 
   2.229 +      this.valueMenuItem.Checked = true;
   2.230 +      this.valueMenuItem.CheckOnClick = true;
   2.231 +      this.valueMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.232 +      this.valueMenuItem.Name = "valueMenuItem";
   2.233 +      this.valueMenuItem.Size = new System.Drawing.Size(152, 22);
   2.234 +      this.valueMenuItem.Text = "Value";
   2.235 +      this.valueMenuItem.CheckedChanged += new System.EventHandler(this.valueMenuItem_CheckedChanged);
   2.236 +      // 
   2.237 +      // minMenuItem
   2.238 +      // 
   2.239 +      this.minMenuItem.Checked = true;
   2.240 +      this.minMenuItem.CheckOnClick = true;
   2.241 +      this.minMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.242 +      this.minMenuItem.Name = "minMenuItem";
   2.243 +      this.minMenuItem.Size = new System.Drawing.Size(152, 22);
   2.244 +      this.minMenuItem.Text = "Min";
   2.245 +      this.minMenuItem.CheckedChanged += new System.EventHandler(this.minMenuItem_CheckedChanged);
   2.246 +      // 
   2.247 +      // maxMenuItem
   2.248 +      // 
   2.249 +      this.maxMenuItem.Checked = true;
   2.250 +      this.maxMenuItem.CheckOnClick = true;
   2.251 +      this.maxMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.252 +      this.maxMenuItem.Name = "maxMenuItem";
   2.253 +      this.maxMenuItem.Size = new System.Drawing.Size(152, 22);
   2.254 +      this.maxMenuItem.Text = "Max";
   2.255 +      this.maxMenuItem.CheckedChanged += new System.EventHandler(this.maxMenuItem_CheckedChanged);
   2.256 +      // 
   2.257 +      // limitMenuItem
   2.258 +      // 
   2.259 +      this.limitMenuItem.Checked = true;
   2.260 +      this.limitMenuItem.CheckOnClick = true;
   2.261 +      this.limitMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
   2.262 +      this.limitMenuItem.Name = "limitMenuItem";
   2.263 +      this.limitMenuItem.Size = new System.Drawing.Size(152, 22);
   2.264 +      this.limitMenuItem.Text = "Limit";
   2.265 +      this.limitMenuItem.CheckedChanged += new System.EventHandler(this.limitMenuItem_CheckedChanged);
   2.266 +      // 
   2.267        // optionsToolStripMenuItem
   2.268        // 
   2.269        this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
   2.270 @@ -578,7 +508,6 @@
   2.271        this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
   2.272        this.Text = "Open Hardware Monitor";
   2.273        this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
   2.274 -      this.columnsContextMenuStrip.ResumeLayout(false);
   2.275        this.menuStrip.ResumeLayout(false);
   2.276        this.menuStrip.PerformLayout();
   2.277        this.splitContainer.Panel1.ResumeLayout(false);
   2.278 @@ -614,21 +543,9 @@
   2.279      private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
   2.280      private Aga.Controls.Tree.TreeColumn limit;
   2.281      private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBoxLimit;
   2.282 -    private System.Windows.Forms.ContextMenuStrip columnsContextMenuStrip;
   2.283 -    private System.Windows.Forms.ToolStripMenuItem minMenuItem;
   2.284 -    private System.Windows.Forms.ToolStripMenuItem maxMenuItem;
   2.285 -    private System.Windows.Forms.ToolStripMenuItem limitMenuItem;
   2.286 -    private System.Windows.Forms.ToolStripMenuItem valueToolStripMenuItem;
   2.287      private System.Windows.Forms.ToolStripMenuItem saveReportToolStripMenuItem;
   2.288 -    private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
   2.289      private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
   2.290 -    private System.Windows.Forms.ToolStripMenuItem sensorsToolStripMenuItem;
   2.291 -    private System.Windows.Forms.ToolStripMenuItem clocksMenuItem;
   2.292 -    private System.Windows.Forms.ToolStripMenuItem tempMenuItem;
   2.293 -    private System.Windows.Forms.ToolStripMenuItem fansMenuItem;
   2.294 -    private System.Windows.Forms.ToolStripMenuItem voltMenuItem;
   2.295      private System.Windows.Forms.ToolStripMenuItem hddMenuItem;
   2.296 -    private System.Windows.Forms.ToolStripMenuItem loadMenuItem;
   2.297      private System.Windows.Forms.ContextMenuStrip notifyContextMenuStrip;
   2.298      private System.Windows.Forms.ToolStripMenuItem hideShowToolStripMenuItem;
   2.299      private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
   2.300 @@ -637,10 +554,16 @@
   2.301      private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
   2.302      private System.Windows.Forms.ContextMenuStrip sensorContextMenuStrip;
   2.303      private System.Windows.Forms.ToolStripMenuItem startMinMenuItem;
   2.304 -    private System.Windows.Forms.ToolStripMenuItem flowsMenuItem;
   2.305      private System.Windows.Forms.ToolStripMenuItem startupMenuItem;
   2.306      private System.Windows.Forms.SaveFileDialog saveFileDialog;
   2.307      private System.Windows.Forms.Timer timer;
   2.308 +    private System.Windows.Forms.ToolStripMenuItem hiddenMenuItem;
   2.309 +    private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
   2.310 +    private System.Windows.Forms.ToolStripMenuItem columnsToolStripMenuItem;
   2.311 +    private System.Windows.Forms.ToolStripMenuItem valueMenuItem;
   2.312 +    private System.Windows.Forms.ToolStripMenuItem minMenuItem;
   2.313 +    private System.Windows.Forms.ToolStripMenuItem maxMenuItem;
   2.314 +    private System.Windows.Forms.ToolStripMenuItem limitMenuItem;
   2.315    }
   2.316  }
   2.317  
     3.1 --- a/GUI/MainForm.cs	Sun May 09 16:22:13 2010 +0000
     3.2 +++ b/GUI/MainForm.cs	Fri May 14 22:30:06 2010 +0000
     3.3 @@ -60,7 +60,6 @@
     3.4      private SensorSystemTray sensorSystemTray;
     3.5      private NotifyIcon notifyIcon;
     3.6      private StartupManager startupManager = new StartupManager();
     3.7 -    private SensorProperties sensorProperties = new SensorProperties();
     3.8      private UpdateVisitor updateVisitor = new UpdateVisitor();
     3.9  
    3.10      public MainForm() {      
    3.11 @@ -119,7 +118,7 @@
    3.12  
    3.13        timer.Enabled = true;
    3.14  
    3.15 -      plotColorPalette = new Color[14];
    3.16 +      plotColorPalette = new Color[13];
    3.17        plotColorPalette[0] = Color.Blue;
    3.18        plotColorPalette[1] = Color.OrangeRed;
    3.19        plotColorPalette[2] = Color.Green;
    3.20 @@ -128,14 +127,16 @@
    3.21        plotColorPalette[5] = Color.DarkViolet;
    3.22        plotColorPalette[6] = Color.YellowGreen;
    3.23        plotColorPalette[7] = Color.SaddleBrown;
    3.24 -      plotColorPalette[8] = Color.Gray;
    3.25 -      plotColorPalette[9] = Color.RoyalBlue;
    3.26 -      plotColorPalette[10] = Color.DeepPink;
    3.27 -      plotColorPalette[11] = Color.MediumSeaGreen;
    3.28 -      plotColorPalette[12] = Color.Olive;
    3.29 -      plotColorPalette[13] = Color.Firebrick;
    3.30 +      plotColorPalette[8] = Color.RoyalBlue;
    3.31 +      plotColorPalette[9] = Color.DeepPink;
    3.32 +      plotColorPalette[10] = Color.MediumSeaGreen;
    3.33 +      plotColorPalette[11] = Color.Olive;
    3.34 +      plotColorPalette[12] = Color.Firebrick;
    3.35  
    3.36 +      hiddenMenuItem.Checked = Config.Get(hiddenMenuItem.Name, false);
    3.37        plotMenuItem.Checked = Config.Get(plotMenuItem.Name, false);
    3.38 +
    3.39 +      valueMenuItem.Checked = Config.Get(valueMenuItem.Name, true);
    3.40        minMenuItem.Checked = Config.Get(minMenuItem.Name, false);
    3.41        maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true);
    3.42        limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
    3.43 @@ -143,14 +144,7 @@
    3.44        startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false); 
    3.45        minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
    3.46        startupMenuItem.Checked = startupManager.Startup;
    3.47 -      hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
    3.48 -
    3.49 -      voltMenuItem.Checked = Config.Get(voltMenuItem.Name, true);
    3.50 -      clocksMenuItem.Checked = Config.Get(clocksMenuItem.Name, true);
    3.51 -      loadMenuItem.Checked = Config.Get(loadMenuItem.Name, true);
    3.52 -      tempMenuItem.Checked = Config.Get(tempMenuItem.Name, true);
    3.53 -      fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
    3.54 -      flowsMenuItem.Checked = Config.Get(flowsMenuItem.Name, true);    
    3.55 +      hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);   
    3.56  
    3.57        if (startMinMenuItem.Checked) {
    3.58          if (!minTrayMenuItem.Checked) {
    3.59 @@ -196,15 +190,18 @@
    3.60          e.Text = sensorNode.ValueToString(sensorNode.Sensor.Limit);
    3.61      }
    3.62  
    3.63 -    private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e) {
    3.64 -      if (!plotMenuItem.Checked)
    3.65 -        return;      
    3.66 -
    3.67 -      SensorNode sensorNode = e.Node.Tag as SensorNode;
    3.68 -      if (sensorNode != null) {
    3.69 +    private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e) {       
    3.70 +      Node node = e.Node.Tag as Node;
    3.71 +      if (node != null) {
    3.72          Color color;
    3.73 -        if (sensorPlotColors.TryGetValue(sensorNode.Sensor, out color)) 
    3.74 -          e.TextColor = color;        
    3.75 +        if (node.IsVisible) {
    3.76 +          SensorNode sensorNode = node as SensorNode;
    3.77 +          if (plotMenuItem.Checked && sensorNode != null &&
    3.78 +            sensorPlotColors.TryGetValue(sensorNode.Sensor, out color))
    3.79 +            e.TextColor = color;
    3.80 +        } else {
    3.81 +          e.TextColor = Color.DarkGray;
    3.82 +        }
    3.83        }
    3.84      }
    3.85  
    3.86 @@ -250,22 +247,18 @@
    3.87      }
    3.88  
    3.89      private void MainForm_FormClosed(object sender, FormClosedEventArgs e) {
    3.90 -            
    3.91 +      
    3.92 +      Config.Set(hiddenMenuItem.Name, hiddenMenuItem.Checked);
    3.93        Config.Set(plotMenuItem.Name, plotMenuItem.Checked);
    3.94 +
    3.95 +      Config.Set(valueMenuItem.Name, valueMenuItem.Checked);
    3.96        Config.Set(minMenuItem.Name, minMenuItem.Checked);
    3.97        Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
    3.98        Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
    3.99  
   3.100        Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
   3.101        Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
   3.102 -      Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
   3.103 -
   3.104 -      Config.Set(voltMenuItem.Name, voltMenuItem.Checked);
   3.105 -      Config.Set(clocksMenuItem.Name, clocksMenuItem.Checked);
   3.106 -      Config.Set(loadMenuItem.Name, loadMenuItem.Checked);
   3.107 -      Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
   3.108 -      Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
   3.109 -      Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked);      
   3.110 +      Config.Set(hddMenuItem.Name, hddMenuItem.Checked);   
   3.111  
   3.112        if (WindowState != FormWindowState.Minimized) {
   3.113          Config.Set("mainForm.Location.X", Location.X);
   3.114 @@ -292,27 +285,6 @@
   3.115        treeView.Invalidate();
   3.116      }
   3.117  
   3.118 -    private void valueToolStripMenuItem_CheckedChanged(object sender, 
   3.119 -      EventArgs e) 
   3.120 -    {
   3.121 -      treeView.Columns[1].IsVisible = valueToolStripMenuItem.Checked;
   3.122 -    }
   3.123 -
   3.124 -    private void minToolStripMenuItem_CheckedChanged(object sender, EventArgs e) 
   3.125 -    {
   3.126 -      treeView.Columns[2].IsVisible = minMenuItem.Checked;
   3.127 -    }
   3.128 -
   3.129 -    private void maxToolStripMenuItem_CheckedChanged(object sender, EventArgs e) 
   3.130 -    {
   3.131 -      treeView.Columns[3].IsVisible = maxMenuItem.Checked;
   3.132 -    }
   3.133 -
   3.134 -    private void limitToolStripMenuItem_CheckedChanged(object sender, 
   3.135 -      EventArgs e) {
   3.136 -      treeView.Columns[4].IsVisible = limitMenuItem.Checked;
   3.137 -    }
   3.138 -
   3.139      private void treeView_Click(object sender, EventArgs e) {
   3.140        
   3.141        MouseEventArgs m = e as MouseEventArgs;
   3.142 @@ -320,9 +292,7 @@
   3.143          return;
   3.144  
   3.145        NodeControlInfo info = treeView.GetNodeControlInfoAt(new Point(m.X, m.Y));
   3.146 -      if (info.Control == null) {
   3.147 -        columnsContextMenuStrip.Show(treeView, m.X, m.Y);
   3.148 -      } else {
   3.149 +      if (info.Control != null) {
   3.150          SensorNode node = info.Node.Tag as SensorNode;
   3.151          if (node != null && node.Sensor != null) {
   3.152  
   3.153 @@ -334,6 +304,19 @@
   3.154              };
   3.155              sensorContextMenuStrip.Items.Add(item);
   3.156            }
   3.157 +          if (node.IsVisible) {
   3.158 +            ToolStripMenuItem item = new ToolStripMenuItem("Hide");
   3.159 +            item.Click += delegate(object obj, EventArgs args) {
   3.160 +              node.IsVisible = false;
   3.161 +            };
   3.162 +            sensorContextMenuStrip.Items.Add(item);
   3.163 +          } else {
   3.164 +            ToolStripMenuItem item = new ToolStripMenuItem("Unhide");
   3.165 +            item.Click += delegate(object obj, EventArgs args) {
   3.166 +              node.IsVisible = true;
   3.167 +            };
   3.168 +            sensorContextMenuStrip.Items.Add(item);
   3.169 +          }         
   3.170            if (sensorSystemTray.Contains(node.Sensor)) {
   3.171              ToolStripMenuItem item = new ToolStripMenuItem("Remove From Tray");
   3.172              item.Click += delegate(object obj, EventArgs args) {
   3.173 @@ -365,31 +348,9 @@
   3.174        EventArgs e) 
   3.175      {
   3.176        computer.HDDEnabled = hddMenuItem.Checked;
   3.177 -      UpdateSensorTypeChecked(null, null);
   3.178        UpdatePlotSelection(null, null);      
   3.179      }
   3.180  
   3.181 -    private void UpdateSensorTypeVisible(Node node) {
   3.182 -      HardwareNode hardwareNode = node as HardwareNode;
   3.183 -      if (hardwareNode == null)
   3.184 -        return;
   3.185 -
   3.186 -      hardwareNode.SetVisible(SensorType.Voltage, voltMenuItem.Checked);
   3.187 -      hardwareNode.SetVisible(SensorType.Clock, clocksMenuItem.Checked);
   3.188 -      hardwareNode.SetVisible(SensorType.Load, loadMenuItem.Checked);
   3.189 -      hardwareNode.SetVisible(SensorType.Temperature, tempMenuItem.Checked);
   3.190 -      hardwareNode.SetVisible(SensorType.Fan, fansMenuItem.Checked);
   3.191 -      hardwareNode.SetVisible(SensorType.Flow, flowsMenuItem.Checked);
   3.192 -
   3.193 -      foreach (Node n in node.Nodes)
   3.194 -        UpdateSensorTypeVisible(n);
   3.195 -    }
   3.196 -
   3.197 -    private void UpdateSensorTypeChecked(object sender, EventArgs e) {          
   3.198 -      foreach (HardwareNode node in root.Nodes) 
   3.199 -        UpdateSensorTypeVisible(node);
   3.200 -    }
   3.201 -
   3.202      private void SysTrayHideShow() {
   3.203        Visible = !Visible;
   3.204        if (Visible)
   3.205 @@ -448,5 +409,26 @@
   3.206      private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) {
   3.207        notifyIcon.Visible = minTrayMenuItem.Checked;
   3.208      }
   3.209 +
   3.210 +    private void hiddenSensorsMenuItem_CheckedChanged(object sender, 
   3.211 +      EventArgs e) {
   3.212 +      treeModel.ForceVisible = hiddenMenuItem.Checked;
   3.213 +    }
   3.214 +
   3.215 +    private void valueMenuItem_CheckedChanged(object sender, EventArgs e) {
   3.216 +      treeView.Columns[1].IsVisible = valueMenuItem.Checked;
   3.217 +    }
   3.218 +
   3.219 +    private void minMenuItem_CheckedChanged(object sender, EventArgs e) {
   3.220 +      treeView.Columns[2].IsVisible = minMenuItem.Checked;
   3.221 +    }
   3.222 +
   3.223 +    private void maxMenuItem_CheckedChanged(object sender, EventArgs e) {
   3.224 +      treeView.Columns[3].IsVisible = maxMenuItem.Checked;
   3.225 +    }
   3.226 +
   3.227 +    private void limitMenuItem_CheckedChanged(object sender, EventArgs e) {
   3.228 +      treeView.Columns[4].IsVisible = limitMenuItem.Checked;
   3.229 +    }
   3.230    }
   3.231  }
     4.1 --- a/GUI/MainForm.resx	Sun May 09 16:22:13 2010 +0000
     4.2 +++ b/GUI/MainForm.resx	Fri May 14 22:30:06 2010 +0000
     4.3 @@ -117,9 +117,6 @@
     4.4    <resheader name="writer">
     4.5      <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     4.6    </resheader>
     4.7 -  <metadata name="columnsContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     4.8 -    <value>125, 17</value>
     4.9 -  </metadata>
    4.10    <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    4.11      <value>17, 17</value>
    4.12    </metadata>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/GUI/Node.cs	Fri May 14 22:30:06 2010 +0000
     5.3 @@ -0,0 +1,199 @@
     5.4 +/*
     5.5 +  
     5.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     5.7 +
     5.8 +  The contents of this file are subject to the Mozilla Public License Version
     5.9 +  1.1 (the "License"); you may not use this file except in compliance with
    5.10 +  the License. You may obtain a copy of the License at
    5.11 + 
    5.12 +  http://www.mozilla.org/MPL/
    5.13 +
    5.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    5.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    5.16 +  for the specific language governing rights and limitations under the License.
    5.17 +
    5.18 +  The Original Code is the Open Hardware Monitor code.
    5.19 +
    5.20 +  The Initial Developer of the Original Code is 
    5.21 +  Michael Möller <m.moeller@gmx.ch>.
    5.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    5.23 +  the Initial Developer. All Rights Reserved.
    5.24 +
    5.25 +  Contributor(s):
    5.26 +
    5.27 +  Alternatively, the contents of this file may be used under the terms of
    5.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    5.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    5.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    5.31 +  of those above. If you wish to allow use of your version of this file only
    5.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    5.33 +  use your version of this file under the terms of the MPL, indicate your
    5.34 +  decision by deleting the provisions above and replace them with the notice
    5.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    5.36 +  the provisions above, a recipient may use your version of this file under
    5.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    5.38 + 
    5.39 +*/
    5.40 +
    5.41 +using System;
    5.42 +using System.Collections.Generic;
    5.43 +using System.Collections.ObjectModel;
    5.44 +using System.Drawing;
    5.45 +using Aga.Controls.Tree;
    5.46 +
    5.47 +namespace OpenHardwareMonitor.GUI {
    5.48 +  public class Node {
    5.49 +
    5.50 +    private TreeModel treeModel;
    5.51 +    private Node parent;
    5.52 +    private NodeCollection nodes;
    5.53 +
    5.54 +    private string text;
    5.55 +    private Image image;
    5.56 +    private bool visible;
    5.57 +
    5.58 +    private TreeModel RootTreeModel() {
    5.59 +      Node node = this;
    5.60 +      while (node != null) {
    5.61 +        if (node.Model != null)
    5.62 +          return node.Model;
    5.63 +        node = node.parent;
    5.64 +      }
    5.65 +      return null;
    5.66 +    }
    5.67 +
    5.68 +    public Node() : this(string.Empty) { }
    5.69 +
    5.70 +    public Node(string text) {
    5.71 +      this.text = text;
    5.72 +      this.nodes = new NodeCollection(this);
    5.73 +      this.visible = true;
    5.74 +    }
    5.75 +
    5.76 +    public TreeModel Model {
    5.77 +      get { return treeModel; }
    5.78 +      set { treeModel = value; }
    5.79 +    }
    5.80 +
    5.81 +    public Node Parent {
    5.82 +      get { return parent; }
    5.83 +      set {
    5.84 +        if (value != parent) {
    5.85 +          if (parent != null)
    5.86 +            parent.nodes.Remove(this);
    5.87 +          if (value != null)
    5.88 +            value.nodes.Add(this);
    5.89 +        }
    5.90 +      }
    5.91 +    }
    5.92 +
    5.93 +    public Collection<Node> Nodes {
    5.94 +      get { return nodes; }
    5.95 +    }
    5.96 +
    5.97 +    public virtual string Text {
    5.98 +      get { return text; }
    5.99 +      set {
   5.100 +        if (text != value) {
   5.101 +          text = value;
   5.102 +        }
   5.103 +      }
   5.104 +    }
   5.105 +
   5.106 +    public Image Image {
   5.107 +      get { return image; }
   5.108 +      set {
   5.109 +        if (image != value) {
   5.110 +          image = value;
   5.111 +        }
   5.112 +      }
   5.113 +    }
   5.114 +
   5.115 +    public virtual bool IsVisible {
   5.116 +      get { return visible; }
   5.117 +      set {
   5.118 +        if (value != visible) {
   5.119 +          visible = value;          
   5.120 +          TreeModel model = RootTreeModel();
   5.121 +          if (model != null && parent != null) {
   5.122 +            int index = 0;
   5.123 +            for (int i = 0; i < parent.nodes.Count; i++) {
   5.124 +              Node node = parent.nodes[i];
   5.125 +              if (node == this)
   5.126 +                break;
   5.127 +              if (node.IsVisible || model.ForceVisible)
   5.128 +                index++;
   5.129 +            }
   5.130 +            if (model.ForceVisible) {
   5.131 +                model.OnNodeChanged(parent, index, this);
   5.132 +            } else {              
   5.133 +              if (value)
   5.134 +                model.OnNodeInserted(parent, index, this);
   5.135 +              else
   5.136 +                model.OnNodeRemoved(parent, index, this);
   5.137 +            }
   5.138 +          }
   5.139 +          if (IsVisibleChanged != null)
   5.140 +            IsVisibleChanged(this);
   5.141 +        }
   5.142 +      }
   5.143 +    }
   5.144 +
   5.145 +    public delegate void NodeEventHandler(Node node);
   5.146 +
   5.147 +    public event NodeEventHandler IsVisibleChanged;
   5.148 +    public event NodeEventHandler NodeAdded;
   5.149 +    public event NodeEventHandler NodeRemoved;
   5.150 +
   5.151 +    private class NodeCollection : Collection<Node> {
   5.152 +      private Node owner;
   5.153 +
   5.154 +      public NodeCollection(Node owner) {
   5.155 +        this.owner = owner;
   5.156 +      }
   5.157 +
   5.158 +      protected override void ClearItems() {
   5.159 +        while (this.Count != 0)
   5.160 +          this.RemoveAt(this.Count - 1);
   5.161 +      }
   5.162 +
   5.163 +      protected override void InsertItem(int index, Node item) {
   5.164 +        if (item == null)
   5.165 +          throw new ArgumentNullException();
   5.166 +
   5.167 +        if (item.parent != owner) {
   5.168 +          if (item.parent != null)
   5.169 +            item.parent.nodes.Remove(item);
   5.170 +          item.parent = owner;
   5.171 +          base.InsertItem(index, item);
   5.172 +
   5.173 +          TreeModel model = owner.RootTreeModel();
   5.174 +          if (model != null)
   5.175 +            model.OnStructureChanged(owner);
   5.176 +          if (owner.NodeAdded != null)
   5.177 +            owner.NodeAdded(item);
   5.178 +        }
   5.179 +      }
   5.180 +
   5.181 +      protected override void RemoveItem(int index) {
   5.182 +        Node item = this[index];
   5.183 +        item.parent = null;
   5.184 +        base.RemoveItem(index);
   5.185 +
   5.186 +        TreeModel model = owner.RootTreeModel();
   5.187 +        if (model != null) 
   5.188 +          model.OnStructureChanged(owner);
   5.189 +        if (owner.NodeRemoved != null)
   5.190 +          owner.NodeRemoved(item);
   5.191 +      }
   5.192 +
   5.193 +      protected override void SetItem(int index, Node item) {
   5.194 +        if (item == null)
   5.195 +          throw new ArgumentNullException();
   5.196 +
   5.197 +        RemoveAt(index);
   5.198 +        InsertItem(index, item);
   5.199 +      }
   5.200 +    }
   5.201 +  }
   5.202 +}
     6.1 --- a/GUI/SensorNode.cs	Sun May 09 16:22:13 2010 +0000
     6.2 +++ b/GUI/SensorNode.cs	Fri May 14 22:30:06 2010 +0000
     6.3 @@ -37,8 +37,8 @@
     6.4  
     6.5  using System;
     6.6  using System.Collections.Generic;
     6.7 -using Aga.Controls.Tree;
     6.8  using OpenHardwareMonitor.Hardware;
     6.9 +using OpenHardwareMonitor.Utilities;
    6.10  
    6.11  namespace OpenHardwareMonitor.GUI {
    6.12    public class SensorNode : Node {
    6.13 @@ -54,7 +54,7 @@
    6.14          return "-";
    6.15      }
    6.16  
    6.17 -    public SensorNode(ISensor sensor) {
    6.18 +    public SensorNode(ISensor sensor) : base() {
    6.19        this.sensor = sensor;
    6.20        switch (sensor.SensorType) {
    6.21          case SensorType.Voltage: format = "{0:F2} V"; break;
    6.22 @@ -63,13 +63,26 @@
    6.23          case SensorType.Temperature: format = "{0:F1} °C"; break;
    6.24          case SensorType.Fan: format = "{0:F0} RPM"; break;
    6.25          case SensorType.Flow: format = "{0:F0} L/h"; break;
    6.26 -      }      
    6.27 +      }
    6.28 +
    6.29 +      bool hidden = Config.Get(new Identifier(sensor.Identifier, 
    6.30 +        "hidden").ToString(), sensor.IsDefaultHidden);
    6.31 +      IsVisible = !hidden;
    6.32      }
    6.33  
    6.34      public override string Text {
    6.35        get { return sensor.Name; }
    6.36        set { sensor.Name = value; }
    6.37 -    }    
    6.38 +    }
    6.39 +
    6.40 +    public override bool IsVisible {
    6.41 +      get { return base.IsVisible; }
    6.42 +      set { 
    6.43 +        base.IsVisible = value;
    6.44 +        Config.Set(new Identifier(sensor.Identifier,
    6.45 +          "hidden").ToString(), !value);
    6.46 +      }
    6.47 +    }
    6.48  
    6.49      public bool Plot {
    6.50        get { return plot; }
     7.1 --- a/GUI/SensorProperties.cs	Sun May 09 16:22:13 2010 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,76 +0,0 @@
     7.4 -/*
     7.5 -  
     7.6 -  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     7.7 -
     7.8 -  The contents of this file are subject to the Mozilla Public License Version
     7.9 -  1.1 (the "License"); you may not use this file except in compliance with
    7.10 -  the License. You may obtain a copy of the License at
    7.11 - 
    7.12 -  http://www.mozilla.org/MPL/
    7.13 -
    7.14 -  Software distributed under the License is distributed on an "AS IS" basis,
    7.15 -  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    7.16 -  for the specific language governing rights and limitations under the License.
    7.17 -
    7.18 -  The Original Code is the Open Hardware Monitor code.
    7.19 -
    7.20 -  The Initial Developer of the Original Code is 
    7.21 -  Michael Möller <m.moeller@gmx.ch>.
    7.22 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
    7.23 -  the Initial Developer. All Rights Reserved.
    7.24 -
    7.25 -  Contributor(s):
    7.26 -
    7.27 -  Alternatively, the contents of this file may be used under the terms of
    7.28 -  either the GNU General Public License Version 2 or later (the "GPL"), or
    7.29 -  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    7.30 -  in which case the provisions of the GPL or the LGPL are applicable instead
    7.31 -  of those above. If you wish to allow use of your version of this file only
    7.32 -  under the terms of either the GPL or the LGPL, and not to allow others to
    7.33 -  use your version of this file under the terms of the MPL, indicate your
    7.34 -  decision by deleting the provisions above and replace them with the notice
    7.35 -  and other provisions required by the GPL or the LGPL. If you do not delete
    7.36 -  the provisions above, a recipient may use your version of this file under
    7.37 -  the terms of any one of the MPL, the GPL or the LGPL.
    7.38 - 
    7.39 -*/
    7.40 -
    7.41 -using System;
    7.42 -using System.Collections.Generic;
    7.43 -using OpenHardwareMonitor.Hardware;
    7.44 -using OpenHardwareMonitor.Utilities;
    7.45 -
    7.46 -namespace OpenHardwareMonitor.GUI {
    7.47 -  public class SensorProperties {
    7.48 -
    7.49 -    private IDictionary<Identifier, Properties> properties = 
    7.50 -      new Dictionary<Identifier, Properties>();
    7.51 -
    7.52 -    private Properties GetProperties(ISensor sensor) {
    7.53 -      Properties value;
    7.54 -      if (!properties.TryGetValue(sensor.Identifier, out value)) {
    7.55 -        value = new Properties(sensor.Identifier, sensor.IsDefaultHidden);
    7.56 -        properties.Add(sensor.Identifier, value);
    7.57 -      }
    7.58 -      return value;
    7.59 -    }
    7.60 -
    7.61 -    public bool IsHidden(ISensor sensor) {
    7.62 -      return GetProperties(sensor).IsHidden;
    7.63 -    }
    7.64 -
    7.65 -    private class Properties {
    7.66 -      private Identifier identifier;
    7.67 -      private bool hidden;
    7.68 -
    7.69 -      public Properties(Identifier identifier, bool defaultHidden) {
    7.70 -        this.identifier = identifier;
    7.71 -
    7.72 -        hidden = Config.Get(new Identifier(identifier, "hidden").ToString(), 
    7.73 -          defaultHidden);    
    7.74 -      }
    7.75 -
    7.76 -      public bool IsHidden { get { return hidden; } }
    7.77 -    }
    7.78 -  }
    7.79 -}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/GUI/TreeModel.cs	Fri May 14 22:30:06 2010 +0000
     8.3 @@ -0,0 +1,150 @@
     8.4 +/*
     8.5 +  
     8.6 +  Version: MPL 1.1/GPL 2.0/LGPL 2.1
     8.7 +
     8.8 +  The contents of this file are subject to the Mozilla Public License Version
     8.9 +  1.1 (the "License"); you may not use this file except in compliance with
    8.10 +  the License. You may obtain a copy of the License at
    8.11 + 
    8.12 +  http://www.mozilla.org/MPL/
    8.13 +
    8.14 +  Software distributed under the License is distributed on an "AS IS" basis,
    8.15 +  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    8.16 +  for the specific language governing rights and limitations under the License.
    8.17 +
    8.18 +  The Original Code is the Open Hardware Monitor code.
    8.19 +
    8.20 +  The Initial Developer of the Original Code is 
    8.21 +  Michael Möller <m.moeller@gmx.ch>.
    8.22 +  Portions created by the Initial Developer are Copyright (C) 2009-2010
    8.23 +  the Initial Developer. All Rights Reserved.
    8.24 +
    8.25 +  Contributor(s):
    8.26 +
    8.27 +  Alternatively, the contents of this file may be used under the terms of
    8.28 +  either the GNU General Public License Version 2 or later (the "GPL"), or
    8.29 +  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    8.30 +  in which case the provisions of the GPL or the LGPL are applicable instead
    8.31 +  of those above. If you wish to allow use of your version of this file only
    8.32 +  under the terms of either the GPL or the LGPL, and not to allow others to
    8.33 +  use your version of this file under the terms of the MPL, indicate your
    8.34 +  decision by deleting the provisions above and replace them with the notice
    8.35 +  and other provisions required by the GPL or the LGPL. If you do not delete
    8.36 +  the provisions above, a recipient may use your version of this file under
    8.37 +  the terms of any one of the MPL, the GPL or the LGPL.
    8.38 + 
    8.39 +*/
    8.40 +
    8.41 +using System;
    8.42 +using System.Collections;
    8.43 +using System.Collections.Generic;
    8.44 +using System.Collections.ObjectModel;
    8.45 +using Aga.Controls.Tree;
    8.46 +
    8.47 +namespace OpenHardwareMonitor.GUI {
    8.48 +  public class TreeModel : ITreeModel {
    8.49 +
    8.50 +    private Node root;
    8.51 +    private bool forceVisible = false;
    8.52 +
    8.53 +    public TreeModel() {
    8.54 +      root = new Node();
    8.55 +      root.Model = this;
    8.56 +    }
    8.57 +
    8.58 +    public TreePath GetPath(Node node) {
    8.59 +      if (node == root)
    8.60 +        return TreePath.Empty;
    8.61 +      else {
    8.62 +        Stack<object> stack = new Stack<object>();
    8.63 +        while (node != root) {
    8.64 +          stack.Push(node);
    8.65 +          node = node.Parent;
    8.66 +        }
    8.67 +        return new TreePath(stack.ToArray());
    8.68 +      }
    8.69 +    }
    8.70 +
    8.71 +    public Collection<Node> Nodes {
    8.72 +      get { return root.Nodes; }
    8.73 +    }
    8.74 +
    8.75 +    private Node GetNode(TreePath treePath) {
    8.76 +      Node parent = root;
    8.77 +      foreach (object obj in treePath.FullPath) {
    8.78 +        Node node = obj as Node;
    8.79 +        if (node == null || node.Parent != parent)
    8.80 +          return null;
    8.81 +        parent = node;
    8.82 +      }
    8.83 +      return parent;
    8.84 +    }
    8.85 +
    8.86 +    public IEnumerable GetChildren(TreePath treePath) {
    8.87 +      Node node = GetNode(treePath);
    8.88 +      if (node != null) {
    8.89 +        foreach (Node n in node.Nodes)
    8.90 +          if (forceVisible || n.IsVisible)
    8.91 +            yield return n;
    8.92 +      } else {
    8.93 +        yield break;
    8.94 +      }
    8.95 +    }
    8.96 +
    8.97 +    public bool IsLeaf(TreePath treePath) {
    8.98 +      return false;
    8.99 +    }
   8.100 +
   8.101 +    public bool ForceVisible {
   8.102 +      get {
   8.103 +        return forceVisible;
   8.104 +      }
   8.105 +      set {
   8.106 +        if (value != forceVisible) {
   8.107 +          forceVisible = value;
   8.108 +          OnStructureChanged(root);
   8.109 +        }
   8.110 +      }
   8.111 +    }
   8.112 +
   8.113 +    #pragma warning disable 67
   8.114 +    public event EventHandler<TreeModelEventArgs> NodesChanged;
   8.115 +    public event EventHandler<TreePathEventArgs> StructureChanged;
   8.116 +    public event EventHandler<TreeModelEventArgs> NodesInserted;
   8.117 +    public event EventHandler<TreeModelEventArgs> NodesRemoved;
   8.118 +    #pragma warning restore 67
   8.119 +
   8.120 +    public void OnNodeChanged(Node parent, int index, Node node) {
   8.121 +      if (NodesChanged != null && parent != null) {
   8.122 +        TreePath path = GetPath(parent);
   8.123 +        if (path != null) 
   8.124 +          NodesChanged(this, new TreeModelEventArgs(
   8.125 +            path, new int[] { index }, new object[] { node }));
   8.126 +      }
   8.127 +    }
   8.128 +
   8.129 +    public void OnStructureChanged(Node node) {
   8.130 +      if (StructureChanged != null)
   8.131 +        StructureChanged(this,
   8.132 +          new TreeModelEventArgs(GetPath(node), new object[0]));
   8.133 +    }
   8.134 +
   8.135 +    public void OnNodeInserted(Node parent, int index, Node node) {
   8.136 +      if (NodesInserted != null) {
   8.137 +        TreeModelEventArgs args = new TreeModelEventArgs(GetPath(parent),
   8.138 +          new int[] { index }, new object[] { node });
   8.139 +        NodesInserted(this, args);
   8.140 +      }
   8.141 +
   8.142 +    }
   8.143 +
   8.144 +    public void OnNodeRemoved(Node parent, int index, Node node) {
   8.145 +      if (NodesRemoved != null) {
   8.146 +        TreeModelEventArgs args = new TreeModelEventArgs(GetPath(parent), 
   8.147 +          new int[] { index }, new object[] { node });
   8.148 +        NodesRemoved(this, args);
   8.149 +      }
   8.150 +    }
   8.151 +
   8.152 +  }
   8.153 +}
     9.1 --- a/GUI/TypeNode.cs	Sun May 09 16:22:13 2010 +0000
     9.2 +++ b/GUI/TypeNode.cs	Fri May 14 22:30:06 2010 +0000
     9.3 @@ -37,14 +37,12 @@
     9.4  
     9.5  using System;
     9.6  using System.Collections.Generic;
     9.7 -using Aga.Controls.Tree;
     9.8  using OpenHardwareMonitor.Hardware;
     9.9  
    9.10  namespace OpenHardwareMonitor.GUI {
    9.11    public class TypeNode : Node {
    9.12  
    9.13      private SensorType sensorType;
    9.14 -    private bool visible = true;
    9.15  
    9.16      public TypeNode(SensorType sensorType) : base() {
    9.17        this.sensorType = sensorType;
    9.18 @@ -75,16 +73,32 @@
    9.19            this.Text = "Flows";
    9.20            break;
    9.21        }
    9.22 +
    9.23 +      NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
    9.24 +      NodeRemoved += new NodeEventHandler(TypeNode_NodeRemoved);
    9.25 +    }
    9.26 +
    9.27 +    private void TypeNode_NodeRemoved(Node node) {
    9.28 +      node.IsVisibleChanged -= new NodeEventHandler(node_IsVisibleChanged);
    9.29 +      node_IsVisibleChanged(null);
    9.30 +    }    
    9.31 +
    9.32 +    private void TypeNode_NodeAdded(Node node) {
    9.33 +      node.IsVisibleChanged += new NodeEventHandler(node_IsVisibleChanged);
    9.34 +      node_IsVisibleChanged(null);
    9.35 +    }
    9.36 +
    9.37 +    private void node_IsVisibleChanged(Node node) {      
    9.38 +      foreach (Node n in Nodes)
    9.39 +        if (n.IsVisible) {
    9.40 +          this.IsVisible = true;
    9.41 +          return;
    9.42 +        }
    9.43 +      this.IsVisible = false;
    9.44      }
    9.45  
    9.46      public SensorType SensorType {
    9.47        get { return sensorType; }
    9.48      }
    9.49 -
    9.50 -    public bool IsVisible {      
    9.51 -      get { return visible; }
    9.52 -      set { visible = value; }
    9.53 -    }
    9.54 -
    9.55    }
    9.56  }
    10.1 --- a/OpenHardwareMonitor.csproj	Sun May 09 16:22:13 2010 +0000
    10.2 +++ b/OpenHardwareMonitor.csproj	Fri May 14 22:30:06 2010 +0000
    10.3 @@ -34,6 +34,7 @@
    10.4      <ErrorReport>prompt</ErrorReport>
    10.5      <WarningLevel>4</WarningLevel>
    10.6      <UseVSHostingProcess>false</UseVSHostingProcess>
    10.7 +    <DebugSymbols>false</DebugSymbols>
    10.8    </PropertyGroup>
    10.9    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Merge|AnyCPU' ">
   10.10      <OutputPath>bin\Merge\</OutputPath>
   10.11 @@ -65,6 +66,7 @@
   10.12      <Compile Include="GUI\CrashReportForm.Designer.cs">
   10.13        <DependentUpon>CrashReportForm.cs</DependentUpon>
   10.14      </Compile>
   10.15 +    <Compile Include="GUI\Node.cs" />
   10.16      <Compile Include="GUI\ParameterForm.cs">
   10.17        <SubType>Form</SubType>
   10.18      </Compile>
   10.19 @@ -72,10 +74,10 @@
   10.20        <DependentUpon>ParameterForm.cs</DependentUpon>
   10.21      </Compile>
   10.22      <Compile Include="GUI\SensorNotifyIcon.cs" />
   10.23 -    <Compile Include="GUI\SensorProperties.cs" />
   10.24      <Compile Include="GUI\SensorSystemTray.cs" />
   10.25      <Compile Include="GUI\StartupManager.cs" />
   10.26      <Compile Include="GUI\TaskScheduler.cs" />
   10.27 +    <Compile Include="GUI\TreeModel.cs" />
   10.28      <Compile Include="GUI\TypeNode.cs" />
   10.29      <Compile Include="GUI\UpdateVisitor.cs" />
   10.30      <Compile Include="Hardware\CPU\AMD10CPU.cs" />