Fixed some problems when compiling in Mono and running on Linux.
1.1 --- a/GUI/Gadget.cs Thu Sep 30 16:51:09 2010 +0000
1.2 +++ b/GUI/Gadget.cs Thu Sep 30 20:59:21 2010 +0000
1.3 @@ -1,4 +1,4 @@
1.4 -/*
1.5 +/*
1.6
1.7 Version: MPL 1.1/GPL 2.0/LGPL 2.1
1.8
1.9 @@ -166,14 +166,17 @@
1.10 }
1.11 set {
1.12 if (value != window.Visible) {
1.13 + window.Visible = value;
1.14 if (value)
1.15 - Redraw();
1.16 - window.Visible = value;
1.17 + Redraw();
1.18 }
1.19 }
1.20 }
1.21
1.22 public void Redraw() {
1.23 + if (!window.Visible)
1.24 + return;
1.25 +
1.26 if (window.Size != buffer.Size) {
1.27 DisposeBuffer();
1.28 CreateBuffer();
2.1 --- a/GUI/GadgetWindow.cs Thu Sep 30 16:51:09 2010 +0000
2.2 +++ b/GUI/GadgetWindow.cs Thu Sep 30 20:59:21 2010 +0000
2.3 @@ -1,4 +1,4 @@
2.4 -/*
2.5 +/*
2.6
2.7 Version: MPL 1.1/GPL 2.0/LGPL 2.1
2.8
2.9 @@ -69,7 +69,7 @@
2.10 // prevent window from fading to a glass sheet when peek is invoked
2.11 try {
2.12 bool value = true;
2.13 - int r = NativeMethods.DwmSetWindowAttribute(Handle,
2.14 + NativeMethods.DwmSetWindowAttribute(Handle,
2.15 WindowAttribute.DWMWA_EXCLUDED_FROM_PEEK, ref value,
2.16 Marshal.SizeOf(value));
2.17 } catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { }
3.1 --- a/GUI/MainForm.cs Thu Sep 30 16:51:09 2010 +0000
3.2 +++ b/GUI/MainForm.cs Thu Sep 30 20:59:21 2010 +0000
3.3 @@ -87,16 +87,7 @@
3.4
3.5 // set the DockStyle here, to avoid conflicts with the MainMenu
3.6 this.splitContainer.Dock = DockStyle.Fill;
3.7 -
3.8 - int p = (int)Environment.OSVersion.Platform;
3.9 - if ((p == 4) || (p == 128)) {
3.10 - splitContainer.BorderStyle = BorderStyle.None;
3.11 - splitContainer.Border3DStyle = Border3DStyle.Adjust;
3.12 - splitContainer.SplitterWidth = 4;
3.13 - treeView.BorderStyle = BorderStyle.Fixed3D;
3.14 - plotPanel.BorderStyle = BorderStyle.Fixed3D;
3.15 - }
3.16 -
3.17 +
3.18 this.Font = SystemFonts.MessageBoxFont;
3.19 treeView.Font = SystemFonts.MessageBoxFont;
3.20 plotPanel.Font = SystemFonts.MessageBoxFont;
3.21 @@ -141,7 +132,18 @@
3.22 systemTray.HideShowCommand += hideShowClick;
3.23 systemTray.ExitCommand += exitClick;
3.24
3.25 - gadget = new SensorGadget(computer, settings, unitManager);
3.26 + int p = (int)Environment.OSVersion.Platform;
3.27 + if ((p == 4) || (p == 128)) { // Unix
3.28 + splitContainer.BorderStyle = BorderStyle.None;
3.29 + splitContainer.Border3DStyle = Border3DStyle.Adjust;
3.30 + splitContainer.SplitterWidth = 4;
3.31 + treeView.BorderStyle = BorderStyle.Fixed3D;
3.32 + plotPanel.BorderStyle = BorderStyle.Fixed3D;
3.33 + gadgetMenuItem.Visible = false;
3.34 + minCloseMenuItem.Visible = false;
3.35 + } else { // Windows
3.36 + gadget = new SensorGadget(computer, settings, unitManager);
3.37 + }
3.38
3.39 computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
3.40 computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
3.41 @@ -218,7 +220,8 @@
3.42
3.43 showGadget = new UserOption("gadgetMenuItem", false, gadgetMenuItem, settings);
3.44 showGadget.Changed += delegate(object sender, EventArgs e) {
3.45 - gadget.Visible = showGadget.Value;
3.46 + if (gadget != null)
3.47 + gadget.Visible = showGadget.Value;
3.48 };
3.49
3.50 celciusMenuItem.Checked =
3.51 @@ -330,8 +333,9 @@
3.52 computer.Accept(updateVisitor);
3.53 treeView.Invalidate();
3.54 plotPanel.Invalidate();
3.55 - systemTray.Redraw();
3.56 - gadget.Redraw();
3.57 + systemTray.Redraw();
3.58 + if (gadget != null)
3.59 + gadget.Redraw();
3.60 }
3.61
3.62 private void SaveConfiguration() {
3.63 @@ -478,18 +482,6 @@
3.64 SysTrayHideShow();
3.65 }
3.66
3.67 - private void removeMenuItem_Click(object sender, EventArgs e) {
3.68 - MenuItem item = sender as MenuItem;
3.69 - if (item == null)
3.70 - return;
3.71 -
3.72 - ISensor sensor = item.Parent.Tag as ISensor;
3.73 - if (sensor == null)
3.74 - return;
3.75 -
3.76 - systemTray.Remove(sensor);
3.77 - }
3.78 -
3.79 private void ShowParameterForm(ISensor sensor) {
3.80 ParameterForm form = new ParameterForm();
3.81 form.Parameters = sensor.Parameters;
4.1 --- a/GUI/SensorGadget.cs Thu Sep 30 16:51:09 2010 +0000
4.2 +++ b/GUI/SensorGadget.cs Thu Sep 30 20:59:21 2010 +0000
4.3 @@ -1,4 +1,4 @@
4.4 -/*
4.5 +/*
4.6
4.7 Version: MPL 1.1/GPL 2.0/LGPL 2.1
4.8
4.9 @@ -391,7 +391,6 @@
4.10 protected override void OnPaint(PaintEventArgs e) {
4.11 Graphics g = e.Graphics;
4.12 int w = Size.Width;
4.13 - int h = Size.Height;
4.14
4.15 g.Clear(Color.Transparent);
4.16
5.1 --- a/GUI/SensorNotifyIcon.cs Thu Sep 30 16:51:09 2010 +0000
5.2 +++ b/GUI/SensorNotifyIcon.cs Thu Sep 30 20:59:21 2010 +0000
5.3 @@ -1,4 +1,4 @@
5.4 -/*
5.5 +/*
5.6
5.7 Version: MPL 1.1/GPL 2.0/LGPL 2.1
5.8
5.9 @@ -187,7 +187,6 @@
5.10 new Rectangle(0, 0, bitmap.Width, bitmap.Height),
5.11 ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
5.12
5.13 - int stride = data.Stride;
5.14 IntPtr Scan0 = data.Scan0;
5.15
5.16 int numBytes = bitmap.Width * bitmap.Height * 4;
6.1 --- a/Hardware/Mainboard/SuperIOHardware.cs Thu Sep 30 16:51:09 2010 +0000
6.2 +++ b/Hardware/Mainboard/SuperIOHardware.cs Thu Sep 30 20:59:21 2010 +0000
6.3 @@ -702,11 +702,19 @@
6.4 public readonly float Vf;
6.5 public readonly bool Hidden;
6.6
6.7 + public Voltage(string name, int index) :
6.8 + this(name, index, false) { }
6.9 +
6.10 public Voltage(string name, int index, bool hidden) :
6.11 this(name, index, 0, 1, 0, hidden) { }
6.12 -
6.13 +
6.14 + public Voltage(string name, int index, float ri, float rf) :
6.15 + this(name, index, ri, rf, 0, false) { }
6.16 +
6.17 + // float ri = 0, float rf = 1, float vf = 0, bool hidden = false)
6.18 +
6.19 public Voltage(string name, int index,
6.20 - float ri = 0, float rf = 1, float vf = 0, bool hidden = false)
6.21 + float ri, float rf, float vf, bool hidden)
6.22 {
6.23 this.Name = name;
6.24 this.Index = index;