mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-02 23:35:29 +00:00
Fixed some problems when compiling in Mono and running on Linux.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
||||||
@@ -166,14 +166,17 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if (value != window.Visible) {
|
if (value != window.Visible) {
|
||||||
|
window.Visible = value;
|
||||||
if (value)
|
if (value)
|
||||||
Redraw();
|
Redraw();
|
||||||
window.Visible = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Redraw() {
|
public void Redraw() {
|
||||||
|
if (!window.Visible)
|
||||||
|
return;
|
||||||
|
|
||||||
if (window.Size != buffer.Size) {
|
if (window.Size != buffer.Size) {
|
||||||
DisposeBuffer();
|
DisposeBuffer();
|
||||||
CreateBuffer();
|
CreateBuffer();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
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
|
// prevent window from fading to a glass sheet when peek is invoked
|
||||||
try {
|
try {
|
||||||
bool value = true;
|
bool value = true;
|
||||||
int r = NativeMethods.DwmSetWindowAttribute(Handle,
|
NativeMethods.DwmSetWindowAttribute(Handle,
|
||||||
WindowAttribute.DWMWA_EXCLUDED_FROM_PEEK, ref value,
|
WindowAttribute.DWMWA_EXCLUDED_FROM_PEEK, ref value,
|
||||||
Marshal.SizeOf(value));
|
Marshal.SizeOf(value));
|
||||||
} catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { }
|
} catch (DllNotFoundException) { } catch (EntryPointNotFoundException) { }
|
||||||
|
@@ -88,15 +88,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
// set the DockStyle here, to avoid conflicts with the MainMenu
|
// set the DockStyle here, to avoid conflicts with the MainMenu
|
||||||
this.splitContainer.Dock = DockStyle.Fill;
|
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;
|
this.Font = SystemFonts.MessageBoxFont;
|
||||||
treeView.Font = SystemFonts.MessageBoxFont;
|
treeView.Font = SystemFonts.MessageBoxFont;
|
||||||
plotPanel.Font = SystemFonts.MessageBoxFont;
|
plotPanel.Font = SystemFonts.MessageBoxFont;
|
||||||
@@ -141,7 +132,18 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
systemTray.HideShowCommand += hideShowClick;
|
systemTray.HideShowCommand += hideShowClick;
|
||||||
systemTray.ExitCommand += exitClick;
|
systemTray.ExitCommand += exitClick;
|
||||||
|
|
||||||
|
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);
|
gadget = new SensorGadget(computer, settings, unitManager);
|
||||||
|
}
|
||||||
|
|
||||||
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
computer.HardwareAdded += new HardwareEventHandler(HardwareAdded);
|
||||||
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
computer.HardwareRemoved += new HardwareEventHandler(HardwareRemoved);
|
||||||
@@ -218,6 +220,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
|
|
||||||
showGadget = new UserOption("gadgetMenuItem", false, gadgetMenuItem, settings);
|
showGadget = new UserOption("gadgetMenuItem", false, gadgetMenuItem, settings);
|
||||||
showGadget.Changed += delegate(object sender, EventArgs e) {
|
showGadget.Changed += delegate(object sender, EventArgs e) {
|
||||||
|
if (gadget != null)
|
||||||
gadget.Visible = showGadget.Value;
|
gadget.Visible = showGadget.Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -331,6 +334,7 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
treeView.Invalidate();
|
treeView.Invalidate();
|
||||||
plotPanel.Invalidate();
|
plotPanel.Invalidate();
|
||||||
systemTray.Redraw();
|
systemTray.Redraw();
|
||||||
|
if (gadget != null)
|
||||||
gadget.Redraw();
|
gadget.Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,18 +482,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
SysTrayHideShow();
|
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) {
|
private void ShowParameterForm(ISensor sensor) {
|
||||||
ParameterForm form = new ParameterForm();
|
ParameterForm form = new ParameterForm();
|
||||||
form.Parameters = sensor.Parameters;
|
form.Parameters = sensor.Parameters;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
|
||||||
@@ -391,7 +391,6 @@ namespace OpenHardwareMonitor.GUI {
|
|||||||
protected override void OnPaint(PaintEventArgs e) {
|
protected override void OnPaint(PaintEventArgs e) {
|
||||||
Graphics g = e.Graphics;
|
Graphics g = e.Graphics;
|
||||||
int w = Size.Width;
|
int w = Size.Width;
|
||||||
int h = Size.Height;
|
|
||||||
|
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
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),
|
new Rectangle(0, 0, bitmap.Width, bitmap.Height),
|
||||||
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
||||||
|
|
||||||
int stride = data.Stride;
|
|
||||||
IntPtr Scan0 = data.Scan0;
|
IntPtr Scan0 = data.Scan0;
|
||||||
|
|
||||||
int numBytes = bitmap.Width * bitmap.Height * 4;
|
int numBytes = bitmap.Width * bitmap.Height * 4;
|
||||||
|
@@ -702,11 +702,19 @@ namespace OpenHardwareMonitor.Hardware.Mainboard {
|
|||||||
public readonly float Vf;
|
public readonly float Vf;
|
||||||
public readonly bool Hidden;
|
public readonly bool Hidden;
|
||||||
|
|
||||||
|
public Voltage(string name, int index) :
|
||||||
|
this(name, index, false) { }
|
||||||
|
|
||||||
public Voltage(string name, int index, bool hidden) :
|
public Voltage(string name, int index, bool hidden) :
|
||||||
this(name, index, 0, 1, 0, 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,
|
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.Name = name;
|
||||||
this.Index = index;
|
this.Index = index;
|
||||||
|
Reference in New Issue
Block a user