1.1 --- a/GUI/MainForm.cs Sun May 09 16:22:13 2010 +0000
1.2 +++ b/GUI/MainForm.cs Fri May 14 22:30:06 2010 +0000
1.3 @@ -60,7 +60,6 @@
1.4 private SensorSystemTray sensorSystemTray;
1.5 private NotifyIcon notifyIcon;
1.6 private StartupManager startupManager = new StartupManager();
1.7 - private SensorProperties sensorProperties = new SensorProperties();
1.8 private UpdateVisitor updateVisitor = new UpdateVisitor();
1.9
1.10 public MainForm() {
1.11 @@ -119,7 +118,7 @@
1.12
1.13 timer.Enabled = true;
1.14
1.15 - plotColorPalette = new Color[14];
1.16 + plotColorPalette = new Color[13];
1.17 plotColorPalette[0] = Color.Blue;
1.18 plotColorPalette[1] = Color.OrangeRed;
1.19 plotColorPalette[2] = Color.Green;
1.20 @@ -128,14 +127,16 @@
1.21 plotColorPalette[5] = Color.DarkViolet;
1.22 plotColorPalette[6] = Color.YellowGreen;
1.23 plotColorPalette[7] = Color.SaddleBrown;
1.24 - plotColorPalette[8] = Color.Gray;
1.25 - plotColorPalette[9] = Color.RoyalBlue;
1.26 - plotColorPalette[10] = Color.DeepPink;
1.27 - plotColorPalette[11] = Color.MediumSeaGreen;
1.28 - plotColorPalette[12] = Color.Olive;
1.29 - plotColorPalette[13] = Color.Firebrick;
1.30 + plotColorPalette[8] = Color.RoyalBlue;
1.31 + plotColorPalette[9] = Color.DeepPink;
1.32 + plotColorPalette[10] = Color.MediumSeaGreen;
1.33 + plotColorPalette[11] = Color.Olive;
1.34 + plotColorPalette[12] = Color.Firebrick;
1.35
1.36 + hiddenMenuItem.Checked = Config.Get(hiddenMenuItem.Name, false);
1.37 plotMenuItem.Checked = Config.Get(plotMenuItem.Name, false);
1.38 +
1.39 + valueMenuItem.Checked = Config.Get(valueMenuItem.Name, true);
1.40 minMenuItem.Checked = Config.Get(minMenuItem.Name, false);
1.41 maxMenuItem.Checked = Config.Get(maxMenuItem.Name, true);
1.42 limitMenuItem.Checked = Config.Get(limitMenuItem.Name, false);
1.43 @@ -143,14 +144,7 @@
1.44 startMinMenuItem.Checked = Config.Get(startMinMenuItem.Name, false);
1.45 minTrayMenuItem.Checked = Config.Get(minTrayMenuItem.Name, true);
1.46 startupMenuItem.Checked = startupManager.Startup;
1.47 - hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
1.48 -
1.49 - voltMenuItem.Checked = Config.Get(voltMenuItem.Name, true);
1.50 - clocksMenuItem.Checked = Config.Get(clocksMenuItem.Name, true);
1.51 - loadMenuItem.Checked = Config.Get(loadMenuItem.Name, true);
1.52 - tempMenuItem.Checked = Config.Get(tempMenuItem.Name, true);
1.53 - fansMenuItem.Checked = Config.Get(fansMenuItem.Name, true);
1.54 - flowsMenuItem.Checked = Config.Get(flowsMenuItem.Name, true);
1.55 + hddMenuItem.Checked = Config.Get(hddMenuItem.Name, true);
1.56
1.57 if (startMinMenuItem.Checked) {
1.58 if (!minTrayMenuItem.Checked) {
1.59 @@ -196,15 +190,18 @@
1.60 e.Text = sensorNode.ValueToString(sensorNode.Sensor.Limit);
1.61 }
1.62
1.63 - private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e) {
1.64 - if (!plotMenuItem.Checked)
1.65 - return;
1.66 -
1.67 - SensorNode sensorNode = e.Node.Tag as SensorNode;
1.68 - if (sensorNode != null) {
1.69 + private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e) {
1.70 + Node node = e.Node.Tag as Node;
1.71 + if (node != null) {
1.72 Color color;
1.73 - if (sensorPlotColors.TryGetValue(sensorNode.Sensor, out color))
1.74 - e.TextColor = color;
1.75 + if (node.IsVisible) {
1.76 + SensorNode sensorNode = node as SensorNode;
1.77 + if (plotMenuItem.Checked && sensorNode != null &&
1.78 + sensorPlotColors.TryGetValue(sensorNode.Sensor, out color))
1.79 + e.TextColor = color;
1.80 + } else {
1.81 + e.TextColor = Color.DarkGray;
1.82 + }
1.83 }
1.84 }
1.85
1.86 @@ -250,22 +247,18 @@
1.87 }
1.88
1.89 private void MainForm_FormClosed(object sender, FormClosedEventArgs e) {
1.90 -
1.91 +
1.92 + Config.Set(hiddenMenuItem.Name, hiddenMenuItem.Checked);
1.93 Config.Set(plotMenuItem.Name, plotMenuItem.Checked);
1.94 +
1.95 + Config.Set(valueMenuItem.Name, valueMenuItem.Checked);
1.96 Config.Set(minMenuItem.Name, minMenuItem.Checked);
1.97 Config.Set(maxMenuItem.Name, maxMenuItem.Checked);
1.98 Config.Set(limitMenuItem.Name, limitMenuItem.Checked);
1.99
1.100 Config.Set(startMinMenuItem.Name, startMinMenuItem.Checked);
1.101 Config.Set(minTrayMenuItem.Name, minTrayMenuItem.Checked);
1.102 - Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
1.103 -
1.104 - Config.Set(voltMenuItem.Name, voltMenuItem.Checked);
1.105 - Config.Set(clocksMenuItem.Name, clocksMenuItem.Checked);
1.106 - Config.Set(loadMenuItem.Name, loadMenuItem.Checked);
1.107 - Config.Set(tempMenuItem.Name, tempMenuItem.Checked);
1.108 - Config.Set(fansMenuItem.Name, fansMenuItem.Checked);
1.109 - Config.Set(flowsMenuItem.Name, flowsMenuItem.Checked);
1.110 + Config.Set(hddMenuItem.Name, hddMenuItem.Checked);
1.111
1.112 if (WindowState != FormWindowState.Minimized) {
1.113 Config.Set("mainForm.Location.X", Location.X);
1.114 @@ -292,27 +285,6 @@
1.115 treeView.Invalidate();
1.116 }
1.117
1.118 - private void valueToolStripMenuItem_CheckedChanged(object sender,
1.119 - EventArgs e)
1.120 - {
1.121 - treeView.Columns[1].IsVisible = valueToolStripMenuItem.Checked;
1.122 - }
1.123 -
1.124 - private void minToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
1.125 - {
1.126 - treeView.Columns[2].IsVisible = minMenuItem.Checked;
1.127 - }
1.128 -
1.129 - private void maxToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
1.130 - {
1.131 - treeView.Columns[3].IsVisible = maxMenuItem.Checked;
1.132 - }
1.133 -
1.134 - private void limitToolStripMenuItem_CheckedChanged(object sender,
1.135 - EventArgs e) {
1.136 - treeView.Columns[4].IsVisible = limitMenuItem.Checked;
1.137 - }
1.138 -
1.139 private void treeView_Click(object sender, EventArgs e) {
1.140
1.141 MouseEventArgs m = e as MouseEventArgs;
1.142 @@ -320,9 +292,7 @@
1.143 return;
1.144
1.145 NodeControlInfo info = treeView.GetNodeControlInfoAt(new Point(m.X, m.Y));
1.146 - if (info.Control == null) {
1.147 - columnsContextMenuStrip.Show(treeView, m.X, m.Y);
1.148 - } else {
1.149 + if (info.Control != null) {
1.150 SensorNode node = info.Node.Tag as SensorNode;
1.151 if (node != null && node.Sensor != null) {
1.152
1.153 @@ -334,6 +304,19 @@
1.154 };
1.155 sensorContextMenuStrip.Items.Add(item);
1.156 }
1.157 + if (node.IsVisible) {
1.158 + ToolStripMenuItem item = new ToolStripMenuItem("Hide");
1.159 + item.Click += delegate(object obj, EventArgs args) {
1.160 + node.IsVisible = false;
1.161 + };
1.162 + sensorContextMenuStrip.Items.Add(item);
1.163 + } else {
1.164 + ToolStripMenuItem item = new ToolStripMenuItem("Unhide");
1.165 + item.Click += delegate(object obj, EventArgs args) {
1.166 + node.IsVisible = true;
1.167 + };
1.168 + sensorContextMenuStrip.Items.Add(item);
1.169 + }
1.170 if (sensorSystemTray.Contains(node.Sensor)) {
1.171 ToolStripMenuItem item = new ToolStripMenuItem("Remove From Tray");
1.172 item.Click += delegate(object obj, EventArgs args) {
1.173 @@ -365,31 +348,9 @@
1.174 EventArgs e)
1.175 {
1.176 computer.HDDEnabled = hddMenuItem.Checked;
1.177 - UpdateSensorTypeChecked(null, null);
1.178 UpdatePlotSelection(null, null);
1.179 }
1.180
1.181 - private void UpdateSensorTypeVisible(Node node) {
1.182 - HardwareNode hardwareNode = node as HardwareNode;
1.183 - if (hardwareNode == null)
1.184 - return;
1.185 -
1.186 - hardwareNode.SetVisible(SensorType.Voltage, voltMenuItem.Checked);
1.187 - hardwareNode.SetVisible(SensorType.Clock, clocksMenuItem.Checked);
1.188 - hardwareNode.SetVisible(SensorType.Load, loadMenuItem.Checked);
1.189 - hardwareNode.SetVisible(SensorType.Temperature, tempMenuItem.Checked);
1.190 - hardwareNode.SetVisible(SensorType.Fan, fansMenuItem.Checked);
1.191 - hardwareNode.SetVisible(SensorType.Flow, flowsMenuItem.Checked);
1.192 -
1.193 - foreach (Node n in node.Nodes)
1.194 - UpdateSensorTypeVisible(n);
1.195 - }
1.196 -
1.197 - private void UpdateSensorTypeChecked(object sender, EventArgs e) {
1.198 - foreach (HardwareNode node in root.Nodes)
1.199 - UpdateSensorTypeVisible(node);
1.200 - }
1.201 -
1.202 private void SysTrayHideShow() {
1.203 Visible = !Visible;
1.204 if (Visible)
1.205 @@ -448,5 +409,26 @@
1.206 private void minTrayMenuItem_CheckedChanged(object sender, EventArgs e) {
1.207 notifyIcon.Visible = minTrayMenuItem.Checked;
1.208 }
1.209 +
1.210 + private void hiddenSensorsMenuItem_CheckedChanged(object sender,
1.211 + EventArgs e) {
1.212 + treeModel.ForceVisible = hiddenMenuItem.Checked;
1.213 + }
1.214 +
1.215 + private void valueMenuItem_CheckedChanged(object sender, EventArgs e) {
1.216 + treeView.Columns[1].IsVisible = valueMenuItem.Checked;
1.217 + }
1.218 +
1.219 + private void minMenuItem_CheckedChanged(object sender, EventArgs e) {
1.220 + treeView.Columns[2].IsVisible = minMenuItem.Checked;
1.221 + }
1.222 +
1.223 + private void maxMenuItem_CheckedChanged(object sender, EventArgs e) {
1.224 + treeView.Columns[3].IsVisible = maxMenuItem.Checked;
1.225 + }
1.226 +
1.227 + private void limitMenuItem_CheckedChanged(object sender, EventArgs e) {
1.228 + treeView.Columns[4].IsVisible = limitMenuItem.Checked;
1.229 + }
1.230 }
1.231 }