Fixed some problems when compiling in Mono and running on Linux.

This commit is contained in:
Michael Möller
2010-09-30 20:59:21 +00:00
parent cc719ae7e8
commit 1e21129803
6 changed files with 38 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -166,14 +166,17 @@ namespace OpenHardwareMonitor.GUI {
}
set {
if (value != window.Visible) {
if (value)
Redraw();
window.Visible = value;
if (value)
Redraw();
}
}
}
public void Redraw() {
if (!window.Visible)
return;
if (window.Size != buffer.Size) {
DisposeBuffer();
CreateBuffer();

View File

@@ -1,4 +1,4 @@
/*
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -69,7 +69,7 @@ namespace OpenHardwareMonitor.GUI {
// prevent window from fading to a glass sheet when peek is invoked
try {
bool value = true;
int r = NativeMethods.DwmSetWindowAttribute(Handle,
NativeMethods.DwmSetWindowAttribute(Handle,
WindowAttribute.DWMWA_EXCLUDED_FROM_PEEK, ref value,
Marshal.SizeOf(value));
} catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { }

View File

@@ -87,16 +87,7 @@ namespace OpenHardwareMonitor.GUI {
// set the DockStyle here, to avoid conflicts with the MainMenu
this.splitContainer.Dock = DockStyle.Fill;
int p = (int)Environment.OSVersion.Platform;
if ((p == 4) || (p == 128)) {
splitContainer.BorderStyle = BorderStyle.None;
splitContainer.Border3DStyle = Border3DStyle.Adjust;
splitContainer.SplitterWidth = 4;
treeView.BorderStyle = BorderStyle.Fixed3D;
plotPanel.BorderStyle = BorderStyle.Fixed3D;
}
this.Font = SystemFonts.MessageBoxFont;
treeView.Font = SystemFonts.MessageBoxFont;
plotPanel.Font = SystemFonts.MessageBoxFont;
@@ -141,7 +132,18 @@ namespace OpenHardwareMonitor.GUI {
systemTray.HideShowCommand += hideShowClick;
systemTray.ExitCommand += exitClick;
gadget = new SensorGadget(computer, settings, unitManager);
int p = (int)Environment.OSVersion.Platform;
if ((p == 4) || (p == 128)) { // Unix
splitContainer.BorderStyle = BorderStyle.None;
splitContainer.Border3DStyle = Border3DStyle.Adjust;
splitContainer.SplitterWidth = 4;
treeView.BorderStyle = BorderStyle.Fixed3D;
plotPanel.BorderStyle = BorderStyle.Fixed3D;
gadgetMenuItem.Visible = false;
minCloseMenuItem.Visible = false;
} else { // Windows
gadget = new SensorGadget(computer, settings, unitManager);
}
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
@@ -218,7 +220,8 @@ namespace OpenHardwareMonitor.GUI {
showGadget = new UserOption("gadgetMenuItem", false, gadgetMenuItem, settings);
showGadget.Changed += delegate(object sender, EventArgs e) {
gadget.Visible = showGadget.Value;
if (gadget != null)
gadget.Visible = showGadget.Value;
};
celciusMenuItem.Checked =
@@ -330,8 +333,9 @@ namespace OpenHardwareMonitor.GUI {
computer.Accept(updateVisitor);
treeView.Invalidate();
plotPanel.Invalidate();
systemTray.Redraw();
gadget.Redraw();
systemTray.Redraw();
if (gadget != null)
gadget.Redraw();
}
private void SaveConfiguration() {
@@ -478,18 +482,6 @@ namespace OpenHardwareMonitor.GUI {
SysTrayHideShow();
}
private void removeMenuItem_Click(object sender, EventArgs e) {
MenuItem item = sender as MenuItem;
if (item == null)
return;
ISensor sensor = item.Parent.Tag as ISensor;
if (sensor == null)
return;
systemTray.Remove(sensor);
}
private void ShowParameterForm(ISensor sensor) {
ParameterForm form = new ParameterForm();
form.Parameters = sensor.Parameters;

View File

@@ -1,4 +1,4 @@
/*
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -391,7 +391,6 @@ namespace OpenHardwareMonitor.GUI {
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
int w = Size.Width;
int h = Size.Height;
g.Clear(Color.Transparent);

View File

@@ -1,4 +1,4 @@
/*
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -187,7 +187,6 @@ namespace OpenHardwareMonitor.GUI {
new Rectangle(0, 0, bitmap.Width, bitmap.Height),
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int stride = data.Stride;
IntPtr Scan0 = data.Scan0;
int numBytes = bitmap.Width * bitmap.Height * 4;

View File

@@ -702,11 +702,19 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
public readonly float Vf;
public readonly bool Hidden;
public Voltage(string name, int index) :
this(name, index, false) { }
public Voltage(string name, int index, bool hidden) :
this(name, index, 0, 1, 0, hidden) { }
public Voltage(string name, int index, float ri, float rf) :
this(name, index, ri, rf, 0, false) { }
// float ri = 0, float rf = 1, float vf = 0, bool hidden = false)
public Voltage(string name, int index,
float ri = 0, float rf = 1, float vf = 0, bool hidden = false)
float ri, float rf, float vf, bool hidden)
{
this.Name = name;
this.Index = index;