Compare commits

...

6 Commits
v0.33 ... v0.34

Author SHA1 Message Date
seerge
06be8c726e Improved Animatrix rendering 2023-03-20 23:27:13 +01:00
seerge
265c6ce417 - 2023-03-20 21:09:11 +01:00
seerge
add852ce5d Animatrix tweaks 2023-03-20 21:07:05 +01:00
seerge
d4a5164b16 - 2023-03-20 19:18:07 +01:00
seerge
14618ee19e Possible fix for theme switching 2023-03-20 19:04:41 +01:00
seerge
0b3a75e373 Minor tweaks 2023-03-20 18:02:38 +01:00
11 changed files with 303 additions and 97 deletions

View File

@@ -4,6 +4,9 @@ using Starlight.Communication;
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using System.Management; using System.Management;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace Starlight.AnimeMatrix namespace Starlight.AnimeMatrix
{ {
@@ -62,26 +65,25 @@ namespace Starlight.AnimeMatrix
Off = 0, Off = 0,
Dim = 1, Dim = 1,
Medium = 2, Medium = 2,
Full = 3 Full = 3,
Super = 4, //test, doesn't work
} }
public class AnimeMatrixDevice : Device public class AnimeMatrixDevice : Device
{ {
private const int UpdatePageLength = 0x0278; int UpdatePageLength = 490;
int LedCount = 1450;
public int LedCount => 1450; byte[] _displayBuffer;
List<byte[]> frames = new List<byte[]>();
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
private List<byte[]> frames = new List<byte[]>();
private int pages = 3;
public int MaxColumns = 34; public int MaxColumns = 34;
public int MaxRows = 61; public int MaxRows = 61;
public int FullRows = 11; public int FullRows = 11;
public int EmptyFirstRow = 0;
private int frameIndex = 0; private int frameIndex = 0;
public AnimeMatrixDevice() public AnimeMatrixDevice()
@@ -89,14 +91,19 @@ namespace Starlight.AnimeMatrix
{ {
string model = GetModel(); string model = GetModel();
Debug.WriteLine(model); Debug.WriteLine(model);
if (model is not null && model.Contains("401")) if (model is not null && model.Contains("401"))
{ {
pages = 2; EmptyFirstRow = 1;
FullRows = 6; FullRows = 6;
MaxColumns = 33; MaxColumns = 33;
MaxRows = 55; MaxRows = 55;
LedCount = 1213;
UpdatePageLength = 410;
} }
_displayBuffer = new byte[LedCount];
} }
@@ -145,6 +152,7 @@ namespace Starlight.AnimeMatrix
public int EmptyColumns(int row) public int EmptyColumns(int row)
{ {
if (row == 0) return EmptyFirstRow;
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0); return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
} }
public int Columns(int row) public int Columns(int row)
@@ -159,11 +167,8 @@ namespace Starlight.AnimeMatrix
var ret = 0; var ret = 0;
if (row > 0) for (var i = 0; i < row; i++)
{ ret += Columns(i);
for (var i = 0; i < row; i++)
ret += Columns(i);
}
return ret; return ret;
} }
@@ -175,13 +180,13 @@ namespace Starlight.AnimeMatrix
public void SetLedLinear(int address, byte value) public void SetLedLinear(int address, byte value)
{ {
EnsureAddressableLed(address); if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value; _displayBuffer[address] = value;
} }
public void SetLedLinearImmediate(int address, byte value) public void SetLedLinearImmediate(int address, byte value)
{ {
EnsureAddressableLed(address); if (!IsAddressableLed(address)) return;
_displayBuffer[address] = value; _displayBuffer[address] = value;
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
@@ -198,7 +203,7 @@ namespace Starlight.AnimeMatrix
EnsureRowInRange(y); EnsureRowInRange(y);
var start = RowToLinearAddress(y) - EmptyColumns(y); var start = RowToLinearAddress(y) - EmptyColumns(y);
if (x > EmptyColumns(y)) if (x >= EmptyColumns(y))
SetLedLinear(start + x, value); SetLedLinear(start + x, value);
} }
@@ -214,26 +219,23 @@ namespace Starlight.AnimeMatrix
public void Present() public void Present()
{ {
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) int page = 0;
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1))) int start, end;
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
.AppendData(_displayBuffer[(UpdatePageLength * 0)..(UpdatePageLength * 1)])
);
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) while (page * UpdatePageLength < LedCount)
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 1 + 1))) {
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength)) start = page * UpdatePageLength;
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)]) end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
);
if (pages > 2)
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02) Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1))) .AppendData(BitConverter.GetBytes((ushort)(start + 1)))
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2))) .AppendData(BitConverter.GetBytes((ushort)(end - start)))
.AppendData( .AppendData(_displayBuffer[start..end])
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
); );
page++;
}
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03)); Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
} }
@@ -270,10 +272,15 @@ namespace Starlight.AnimeMatrix
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte)); Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
} }
static int GetColor(Bitmap bmp, int x, int y)
{
var pixel = bmp.GetPixel(Math.Max(0,Math.Min(bmp.Width - 1,x)), Math.Max(0, Math.Min(bmp.Height - 1, y)));
return (Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
}
public void GenerateFrame(Image image) public void GenerateFrame(Image image)
{ {
int width = MaxColumns * 3; int width = MaxColumns*3;
int height = MaxRows; int height = MaxRows;
float scale; float scale;
@@ -289,17 +296,20 @@ namespace Starlight.AnimeMatrix
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight); graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
Bitmap bmp = new Bitmap(canvas, MaxColumns, MaxRows); Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows);
for (int y = 0; y < bmp.Height; y++) for (int y = 0; y < bmp.Height; y++)
{ {
for (int x = 0; x < bmp.Width; x++) for (int x = 0; x < bmp.Width; x++)
{ {
var pixel = bmp.GetPixel(x, y); if (x % 2 == (y % 2))
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0)); {
SetLedPlanar(x, y, color); var color = GetColor(bmp, x, y);
//var color2= GetColor(bmp, x+1, y);
SetLedPlanar(x/2,y, (byte)color);
}
} }
} }
@@ -313,12 +323,9 @@ namespace Starlight.AnimeMatrix
} }
} }
private void EnsureAddressableLed(int address) private bool IsAddressableLed(int address)
{ {
if (address < 0 || address >= LedCount) return (address >= 0 && address < LedCount);
{
throw new IndexOutOfRangeException($"Linear LED address must be in range of [0, {LedCount - 1}].");
}
} }
} }
} }

View File

@@ -6,31 +6,35 @@ public static class ControlHelper
{ {
static bool _invert = false; static bool _invert = false;
static bool _resize = false;
static float _scale = 1; static float _scale = 1;
static Color formBack; static Color formBack;
static Color backMain; static Color backMain;
static Color foreMain; static Color foreMain;
static Color foreAccent;
static Color borderMain; static Color borderMain;
static Color buttonMain; static Color buttonMain;
public static void Adjust(RForm container, float baseScale = 2, bool invert = false) public static void Adjust(RForm container, bool darkTheme = false, bool invert = false)
{ {
_scale = GetDpiScale(container).Value / baseScale;
if (container.darkTheme) if (darkTheme)
{ {
formBack = Color.FromArgb(255, 35, 35, 35); formBack = Color.FromArgb(255, 35, 35, 35);
backMain = Color.FromArgb(255, 50, 50, 50); backMain = Color.FromArgb(255, 50, 50, 50);
foreMain = Color.White; foreMain = Color.White;
foreAccent = Color.FromArgb(255, 100, 100, 100);
borderMain = Color.FromArgb(255, 50, 50, 50); borderMain = Color.FromArgb(255, 50, 50, 50);
buttonMain = Color.FromArgb(255, 100, 100, 100); buttonMain = Color.FromArgb(255, 80, 80, 80);
} }
else else
{ {
formBack = SystemColors.Control; formBack = SystemColors.Control;
backMain = SystemColors.ControlLightLight; backMain = SystemColors.ControlLightLight;
foreMain = SystemColors.ControlText; foreMain = SystemColors.ControlText;
foreAccent = Color.LightGray;
borderMain = Color.LightGray; borderMain = Color.LightGray;
buttonMain = SystemColors.ControlLight; buttonMain = SystemColors.ControlLight;
} }
@@ -43,15 +47,38 @@ public static class ControlHelper
_invert = false; _invert = false;
} }
public static void Resize(RForm container, float baseScale = 2)
{
_scale = GetDpiScale(container).Value / baseScale;
ResizeControls(container.Controls);
}
private static void ResizeControls(Control.ControlCollection controls)
{
foreach (Control control in controls)
{
var button = control as RButton;
if (button != null && button.Image is not null)
button.Image = ResizeImage(button.Image);
var pictureBox = control as PictureBox;
if (pictureBox != null && pictureBox.BackgroundImage is not null)
pictureBox.BackgroundImage = ResizeImage(pictureBox.BackgroundImage);
ResizeControls(control.Controls);
}
}
private static void AdjustControls(Control.ControlCollection controls) private static void AdjustControls(Control.ControlCollection controls)
{ {
foreach (Control control in controls) foreach (Control control in controls)
{ {
var button = control as Button; var button = control as RButton;
if (button != null) if (button != null)
{ {
button.BackColor = backMain; button.BackColor = button.Secondary ? buttonMain : backMain;
button.ForeColor = foreMain; button.ForeColor = foreMain;
button.FlatStyle = FlatStyle.Flat; button.FlatStyle = FlatStyle.Flat;
@@ -62,11 +89,9 @@ public static class ControlHelper
} }
var pictureBox = control as PictureBox; var pictureBox = control as PictureBox;
if (pictureBox != null) if (pictureBox != null && pictureBox.BackgroundImage is not null)
{ pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
if (pictureBox.BackgroundImage is not null)
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
}
var combo = control as RComboBox; var combo = control as RComboBox;
if (combo != null) if (combo != null)
@@ -89,8 +114,8 @@ public static class ControlHelper
{ {
chart.BackColor = backMain; chart.BackColor = backMain;
chart.ChartAreas[0].BackColor = backMain; chart.ChartAreas[0].BackColor = backMain;
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreMain; chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreMain; chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
chart.ChartAreas[0].AxisX.TitleForeColor = foreMain; chart.ChartAreas[0].AxisX.TitleForeColor = foreMain;
chart.ChartAreas[0].AxisY.TitleForeColor = foreMain; chart.ChartAreas[0].AxisY.TitleForeColor = foreMain;
@@ -101,8 +126,8 @@ public static class ControlHelper
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain; chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain; chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain;
chart.ChartAreas[0].AxisX.LineColor = foreMain; chart.ChartAreas[0].AxisX.LineColor = foreAccent;
chart.ChartAreas[0].AxisY.LineColor = foreMain; chart.ChartAreas[0].AxisY.LineColor = foreAccent;
chart.Titles[0].ForeColor = foreMain; chart.Titles[0].ForeColor = foreMain;
@@ -121,7 +146,7 @@ public static class ControlHelper
}); });
} }
private static Image AdjustImage(Image image) private static Image ResizeImage(Image image)
{ {
var newSize = new Size((int)(image.Width * _scale), (int)(image.Height * _scale)); var newSize = new Size((int)(image.Width * _scale), (int)(image.Height * _scale));
var pic = new Bitmap(newSize.Width, newSize.Height); var pic = new Bitmap(newSize.Width, newSize.Height);
@@ -131,6 +156,12 @@ public static class ControlHelper
g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(image, new Rectangle(new Point(), newSize)); g.DrawImage(image, new Rectangle(new Point(), newSize));
} }
return pic;
}
private static Image AdjustImage(Image image)
{
var pic = new Bitmap(image);
if (_invert) if (_invert)
{ {
@@ -145,6 +176,7 @@ public static class ControlHelper
} }
return pic; return pic;
} }
} }

View File

@@ -1,4 +1,5 @@
using System.ComponentModel; using Microsoft.Win32;
using System.ComponentModel;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -18,25 +19,38 @@ namespace CustomControls
[DllImport("DwmApi")] //System.Runtime.InteropServices [DllImport("DwmApi")] //System.Runtime.InteropServices
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize); private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
public bool darkTheme; public bool darkTheme = false;
public bool invert = false;
public void InitTheme() private static bool IsDarkTheme()
{ {
bool newDarkTheme = CheckSystemDarkModeStatus(); using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
invert = (darkTheme != newDarkTheme); var registryValueObject = key?.GetValue("AppsUseLightTheme");
if (registryValueObject == null) return false;
return (int)registryValueObject <= 0;
}
public void InitTheme(bool setDPI = true)
{
bool newDarkTheme = IsDarkTheme();
bool changed = (darkTheme != newDarkTheme);
darkTheme = newDarkTheme; darkTheme = newDarkTheme;
ControlHelper.Adjust(this, 2, invert); if (setDPI)
try ControlHelper.Resize(this);
{
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4); DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
} catch { } ControlHelper.Adjust(this, darkTheme, changed);
} }
} }
public class RTrackBar : TrackBar
{
}
public class RComboBox : ComboBox public class RComboBox : ComboBox
{ {
private Color borderColor = Color.Gray; private Color borderColor = Color.Gray;
@@ -221,8 +235,11 @@ namespace CustomControls
{ {
//Fields //Fields
private int borderSize = 5; private int borderSize = 5;
private int borderRadius = 3; private int borderRadius = 5;
private bool activated = false; private bool activated = false;
private bool secondary = false;
private Color borderColor = Color.Transparent; private Color borderColor = Color.Transparent;
public Color BorderColor public Color BorderColor
@@ -247,6 +264,14 @@ namespace CustomControls
} }
} }
public bool Secondary
{
get { return secondary; }
set
{
secondary = value;
}
}
public RButton() public RButton()
{ {

120
app/CustomControls.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

27
app/Fans.Designer.cs generated
View File

@@ -31,10 +31,10 @@ namespace GHelper
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
ChartArea chartArea3 = new ChartArea(); ChartArea chartArea1 = new ChartArea();
Title title3 = new Title(); Title title1 = new Title();
ChartArea chartArea4 = new ChartArea(); ChartArea chartArea2 = new ChartArea();
Title title4 = new Title(); Title title2 = new Title();
panelFans = new Panel(); panelFans = new Panel();
labelTip = new Label(); labelTip = new Label();
labelBoost = new Label(); labelBoost = new Label();
@@ -160,8 +160,8 @@ namespace GHelper
// //
// chartGPU // chartGPU
// //
chartArea3.Name = "ChartArea1"; chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea3); chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Dock = DockStyle.Fill; chartGPU.Dock = DockStyle.Fill;
chartGPU.Location = new Point(2, 506); chartGPU.Location = new Point(2, 506);
chartGPU.Margin = new Padding(2, 10, 2, 10); chartGPU.Margin = new Padding(2, 10, 2, 10);
@@ -169,13 +169,13 @@ namespace GHelper
chartGPU.Size = new Size(760, 476); chartGPU.Size = new Size(760, 476);
chartGPU.TabIndex = 17; chartGPU.TabIndex = 17;
chartGPU.Text = "chart1"; chartGPU.Text = "chart1";
title3.Name = "Title1"; title1.Name = "Title1";
chartGPU.Titles.Add(title3); chartGPU.Titles.Add(title1);
// //
// chartCPU // chartCPU
// //
chartArea4.Name = "ChartArea1"; chartArea2.Name = "ChartArea1";
chartCPU.ChartAreas.Add(chartArea4); chartCPU.ChartAreas.Add(chartArea2);
chartCPU.Dock = DockStyle.Fill; chartCPU.Dock = DockStyle.Fill;
chartCPU.Location = new Point(2, 10); chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10); chartCPU.Margin = new Padding(2, 10, 2, 10);
@@ -183,8 +183,8 @@ namespace GHelper
chartCPU.Size = new Size(760, 476); chartCPU.Size = new Size(760, 476);
chartCPU.TabIndex = 14; chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU"; chartCPU.Text = "chartCPU";
title4.Name = "Title1"; title2.Name = "Title1";
chartCPU.Titles.Add(title4); chartCPU.Titles.Add(title2);
// //
// labelFans // labelFans
// //
@@ -219,6 +219,7 @@ namespace GHelper
buttonReset.Location = new Point(30, 1081); buttonReset.Location = new Point(30, 1081);
buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Margin = new Padding(4, 2, 4, 2);
buttonReset.Name = "buttonReset"; buttonReset.Name = "buttonReset";
buttonReset.Secondary = true;
buttonReset.Size = new Size(232, 44); buttonReset.Size = new Size(232, 44);
buttonReset.TabIndex = 15; buttonReset.TabIndex = 15;
buttonReset.Text = "Factory Defaults"; buttonReset.Text = "Factory Defaults";
@@ -234,6 +235,7 @@ namespace GHelper
buttonApply.Location = new Point(542, 1081); buttonApply.Location = new Point(542, 1081);
buttonApply.Margin = new Padding(4, 2, 4, 2); buttonApply.Margin = new Padding(4, 2, 4, 2);
buttonApply.Name = "buttonApply"; buttonApply.Name = "buttonApply";
buttonApply.Secondary = true;
buttonApply.Size = new Size(248, 44); buttonApply.Size = new Size(248, 44);
buttonApply.TabIndex = 14; buttonApply.TabIndex = 14;
buttonApply.Text = "Apply Fan Curve"; buttonApply.Text = "Apply Fan Curve";
@@ -303,6 +305,7 @@ namespace GHelper
buttonApplyPower.Location = new Point(20, 1081); buttonApplyPower.Location = new Point(20, 1081);
buttonApplyPower.Margin = new Padding(4, 2, 4, 2); buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
buttonApplyPower.Name = "buttonApplyPower"; buttonApplyPower.Name = "buttonApplyPower";
buttonApplyPower.Secondary = true;
buttonApplyPower.Size = new Size(324, 44); buttonApplyPower.Size = new Size(324, 44);
buttonApplyPower.TabIndex = 24; buttonApplyPower.TabIndex = 24;
buttonApplyPower.Text = "Apply Power Limits"; buttonApplyPower.Text = "Apply Power Limits";

View File

@@ -35,9 +35,6 @@ namespace GHelper
chart.Titles[0].Text = title; chart.Titles[0].Text = title;
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas[0].AxisX.Minimum = 10; chart.ChartAreas[0].AxisX.Minimum = 10;
chart.ChartAreas[0].AxisX.Maximum = 100; chart.ChartAreas[0].AxisX.Maximum = 100;
chart.ChartAreas[0].AxisX.Interval = 10; chart.ChartAreas[0].AxisX.Interval = 10;

View File

@@ -16,7 +16,7 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.34</AssemblyVersion> <AssemblyVersion>0.33</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -49,7 +49,8 @@ namespace GHelper
} }
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged; SystemEvents.UserPreferenceChanged += new
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
Application.EnableVisualStyles(); Application.EnableVisualStyles();
@@ -81,7 +82,7 @@ namespace GHelper
} }
static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{ {
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return; if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
@@ -91,13 +92,14 @@ namespace GHelper
{ {
case UserPreferenceCategory.General: case UserPreferenceCategory.General:
Debug.WriteLine("Theme Changed"); Debug.WriteLine("Theme Changed");
settingsForm.InitTheme(); Thread.Sleep(500);
settingsForm.InitTheme(false);
if (settingsForm.fans is not null && settingsForm.fans.Text != "") if (settingsForm.fans is not null && settingsForm.fans.Text != "")
settingsForm.fans.InitTheme(); settingsForm.fans.InitTheme(false);
if (settingsForm.keyb is not null && settingsForm.keyb.Text != "") if (settingsForm.keyb is not null && settingsForm.keyb.Text != "")
settingsForm.keyb.InitTheme(); settingsForm.keyb.InitTheme(false);
break; break;
} }

View File

@@ -186,6 +186,7 @@ namespace GHelper
buttonMatrix.Location = new Point(390, 8); buttonMatrix.Location = new Point(390, 8);
buttonMatrix.Margin = new Padding(4, 8, 4, 8); buttonMatrix.Margin = new Padding(4, 8, 4, 8);
buttonMatrix.Name = "buttonMatrix"; buttonMatrix.Name = "buttonMatrix";
buttonMatrix.Secondary = true;
buttonMatrix.Size = new Size(185, 44); buttonMatrix.Size = new Size(185, 44);
buttonMatrix.TabIndex = 43; buttonMatrix.TabIndex = 43;
buttonMatrix.Text = "Picture / Gif"; buttonMatrix.Text = "Picture / Gif";
@@ -330,6 +331,7 @@ namespace GHelper
buttonQuit.Location = new Point(578, 16); buttonQuit.Location = new Point(578, 16);
buttonQuit.Margin = new Padding(8, 4, 8, 4); buttonQuit.Margin = new Padding(8, 4, 8, 4);
buttonQuit.Name = "buttonQuit"; buttonQuit.Name = "buttonQuit";
buttonQuit.Secondary = true;
buttonQuit.Size = new Size(208, 44); buttonQuit.Size = new Size(208, 44);
buttonQuit.TabIndex = 18; buttonQuit.TabIndex = 18;
buttonQuit.Text = "Quit"; buttonQuit.Text = "Quit";
@@ -434,6 +436,7 @@ namespace GHelper
buttonSilent.Location = new Point(4, 4); buttonSilent.Location = new Point(4, 4);
buttonSilent.Margin = new Padding(4); buttonSilent.Margin = new Padding(4);
buttonSilent.Name = "buttonSilent"; buttonSilent.Name = "buttonSilent";
buttonSilent.Secondary = false;
buttonSilent.Size = new Size(185, 120); buttonSilent.Size = new Size(185, 120);
buttonSilent.TabIndex = 0; buttonSilent.TabIndex = 0;
buttonSilent.Text = "Silent"; buttonSilent.Text = "Silent";
@@ -454,6 +457,7 @@ namespace GHelper
buttonBalanced.Location = new Point(197, 4); buttonBalanced.Location = new Point(197, 4);
buttonBalanced.Margin = new Padding(4); buttonBalanced.Margin = new Padding(4);
buttonBalanced.Name = "buttonBalanced"; buttonBalanced.Name = "buttonBalanced";
buttonBalanced.Secondary = false;
buttonBalanced.Size = new Size(185, 120); buttonBalanced.Size = new Size(185, 120);
buttonBalanced.TabIndex = 1; buttonBalanced.TabIndex = 1;
buttonBalanced.Text = "Balanced"; buttonBalanced.Text = "Balanced";
@@ -474,6 +478,7 @@ namespace GHelper
buttonTurbo.Location = new Point(390, 4); buttonTurbo.Location = new Point(390, 4);
buttonTurbo.Margin = new Padding(4); buttonTurbo.Margin = new Padding(4);
buttonTurbo.Name = "buttonTurbo"; buttonTurbo.Name = "buttonTurbo";
buttonTurbo.Secondary = false;
buttonTurbo.Size = new Size(185, 120); buttonTurbo.Size = new Size(185, 120);
buttonTurbo.TabIndex = 2; buttonTurbo.TabIndex = 2;
buttonTurbo.Text = "Turbo"; buttonTurbo.Text = "Turbo";
@@ -493,6 +498,7 @@ namespace GHelper
buttonFans.Location = new Point(583, 4); buttonFans.Location = new Point(583, 4);
buttonFans.Margin = new Padding(4); buttonFans.Margin = new Padding(4);
buttonFans.Name = "buttonFans"; buttonFans.Name = "buttonFans";
buttonFans.Secondary = true;
buttonFans.Size = new Size(185, 120); buttonFans.Size = new Size(185, 120);
buttonFans.TabIndex = 35; buttonFans.TabIndex = 35;
buttonFans.Text = "Fans + Power"; buttonFans.Text = "Fans + Power";
@@ -596,6 +602,7 @@ namespace GHelper
buttonEco.Location = new Point(4, 4); buttonEco.Location = new Point(4, 4);
buttonEco.Margin = new Padding(4); buttonEco.Margin = new Padding(4);
buttonEco.Name = "buttonEco"; buttonEco.Name = "buttonEco";
buttonEco.Secondary = false;
buttonEco.Size = new Size(185, 120); buttonEco.Size = new Size(185, 120);
buttonEco.TabIndex = 0; buttonEco.TabIndex = 0;
buttonEco.Text = "Eco"; buttonEco.Text = "Eco";
@@ -616,6 +623,7 @@ namespace GHelper
buttonStandard.Location = new Point(197, 4); buttonStandard.Location = new Point(197, 4);
buttonStandard.Margin = new Padding(4); buttonStandard.Margin = new Padding(4);
buttonStandard.Name = "buttonStandard"; buttonStandard.Name = "buttonStandard";
buttonStandard.Secondary = false;
buttonStandard.Size = new Size(185, 120); buttonStandard.Size = new Size(185, 120);
buttonStandard.TabIndex = 1; buttonStandard.TabIndex = 1;
buttonStandard.Text = "Standard"; buttonStandard.Text = "Standard";
@@ -636,6 +644,7 @@ namespace GHelper
buttonOptimized.Location = new Point(583, 4); buttonOptimized.Location = new Point(583, 4);
buttonOptimized.Margin = new Padding(4); buttonOptimized.Margin = new Padding(4);
buttonOptimized.Name = "buttonOptimized"; buttonOptimized.Name = "buttonOptimized";
buttonOptimized.Secondary = false;
buttonOptimized.Size = new Size(185, 120); buttonOptimized.Size = new Size(185, 120);
buttonOptimized.TabIndex = 3; buttonOptimized.TabIndex = 3;
buttonOptimized.Text = "Optimized"; buttonOptimized.Text = "Optimized";
@@ -656,6 +665,7 @@ namespace GHelper
buttonUltimate.Location = new Point(390, 4); buttonUltimate.Location = new Point(390, 4);
buttonUltimate.Margin = new Padding(4); buttonUltimate.Margin = new Padding(4);
buttonUltimate.Name = "buttonUltimate"; buttonUltimate.Name = "buttonUltimate";
buttonUltimate.Secondary = false;
buttonUltimate.Size = new Size(185, 120); buttonUltimate.Size = new Size(185, 120);
buttonUltimate.TabIndex = 2; buttonUltimate.TabIndex = 2;
buttonUltimate.Text = "Ultimate"; buttonUltimate.Text = "Ultimate";
@@ -700,6 +710,8 @@ namespace GHelper
tableScreen.Controls.Add(buttonScreenAuto, 0, 0); tableScreen.Controls.Add(buttonScreenAuto, 0, 0);
tableScreen.Controls.Add(button60Hz, 1, 0); tableScreen.Controls.Add(button60Hz, 1, 0);
tableScreen.Controls.Add(button120Hz, 2, 0); tableScreen.Controls.Add(button120Hz, 2, 0);
tableScreen.Controls.Add(buttonMiniled, 3, 0);
tableScreen.Location = new Point(16, 51); tableScreen.Location = new Point(16, 51);
tableScreen.Margin = new Padding(8, 4, 8, 4); tableScreen.Margin = new Padding(8, 4, 8, 4);
tableScreen.Name = "tableScreen"; tableScreen.Name = "tableScreen";
@@ -720,6 +732,7 @@ namespace GHelper
buttonScreenAuto.Location = new Point(4, 4); buttonScreenAuto.Location = new Point(4, 4);
buttonScreenAuto.Margin = new Padding(4); buttonScreenAuto.Margin = new Padding(4);
buttonScreenAuto.Name = "buttonScreenAuto"; buttonScreenAuto.Name = "buttonScreenAuto";
buttonScreenAuto.Secondary = false;
buttonScreenAuto.Size = new Size(185, 72); buttonScreenAuto.Size = new Size(185, 72);
buttonScreenAuto.TabIndex = 0; buttonScreenAuto.TabIndex = 0;
buttonScreenAuto.Text = "Auto"; buttonScreenAuto.Text = "Auto";
@@ -738,6 +751,7 @@ namespace GHelper
button60Hz.Location = new Point(197, 4); button60Hz.Location = new Point(197, 4);
button60Hz.Margin = new Padding(4); button60Hz.Margin = new Padding(4);
button60Hz.Name = "button60Hz"; button60Hz.Name = "button60Hz";
button60Hz.Secondary = false;
button60Hz.Size = new Size(185, 72); button60Hz.Size = new Size(185, 72);
button60Hz.TabIndex = 1; button60Hz.TabIndex = 1;
button60Hz.Text = "60Hz"; button60Hz.Text = "60Hz";
@@ -755,6 +769,7 @@ namespace GHelper
button120Hz.Location = new Point(390, 4); button120Hz.Location = new Point(390, 4);
button120Hz.Margin = new Padding(4); button120Hz.Margin = new Padding(4);
button120Hz.Name = "button120Hz"; button120Hz.Name = "button120Hz";
button120Hz.Secondary = false;
button120Hz.Size = new Size(185, 72); button120Hz.Size = new Size(185, 72);
button120Hz.TabIndex = 2; button120Hz.TabIndex = 2;
button120Hz.Text = "120Hz + OD"; button120Hz.Text = "120Hz + OD";
@@ -829,6 +844,7 @@ namespace GHelper
buttonKeyboard.Location = new Point(390, 8); buttonKeyboard.Location = new Point(390, 8);
buttonKeyboard.Margin = new Padding(4, 8, 4, 8); buttonKeyboard.Margin = new Padding(4, 8, 4, 8);
buttonKeyboard.Name = "buttonKeyboard"; buttonKeyboard.Name = "buttonKeyboard";
buttonKeyboard.Secondary = true;
buttonKeyboard.Size = new Size(185, 44); buttonKeyboard.Size = new Size(185, 44);
buttonKeyboard.TabIndex = 37; buttonKeyboard.TabIndex = 37;
buttonKeyboard.Text = "Extra"; buttonKeyboard.Text = "Extra";
@@ -895,6 +911,7 @@ namespace GHelper
buttonKeyboardColor.Location = new Point(0, 0); buttonKeyboardColor.Location = new Point(0, 0);
buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8); buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8);
buttonKeyboardColor.Name = "buttonKeyboardColor"; buttonKeyboardColor.Name = "buttonKeyboardColor";
buttonKeyboardColor.Secondary = false;
buttonKeyboardColor.Size = new Size(185, 44); buttonKeyboardColor.Size = new Size(185, 44);
buttonKeyboardColor.TabIndex = 39; buttonKeyboardColor.TabIndex = 39;
buttonKeyboardColor.Text = "Color "; buttonKeyboardColor.Text = "Color ";
@@ -935,6 +952,7 @@ namespace GHelper
buttonMiniled.Location = new Point(197, 4); buttonMiniled.Location = new Point(197, 4);
buttonMiniled.Margin = new Padding(4); buttonMiniled.Margin = new Padding(4);
buttonMiniled.Name = "buttonMiniled"; buttonMiniled.Name = "buttonMiniled";
buttonMiniled.Secondary = false;
buttonMiniled.Size = new Size(185, 72); buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3; buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled"; buttonMiniled.Text = "Miniled";

View File

@@ -532,8 +532,8 @@ namespace GHelper
int brightness = Program.config.getConfig("matrix_brightness"); int brightness = Program.config.getConfig("matrix_brightness");
int running = Program.config.getConfig("matrix_running"); int running = Program.config.getConfig("matrix_running");
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0; comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count-1) : 0;
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0; comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0;
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1); checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
@@ -705,9 +705,11 @@ namespace GHelper
if (miniled >= 0) if (miniled >= 0)
{ {
tableScreen.Controls.Add(buttonMiniled, 3, 0);
buttonMiniled.Activated = (miniled == 1); buttonMiniled.Activated = (miniled == 1);
Program.config.setConfig("miniled", miniled); Program.config.setConfig("miniled", miniled);
} else
{
buttonMiniled.Visible = false;
} }
Program.config.setConfig("frequency", frequency); Program.config.setConfig("frequency", frequency);

BIN
docs/screenshot-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB