mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06be8c726e | ||
|
|
265c6ce417 | ||
|
|
add852ce5d | ||
|
|
d4a5164b16 | ||
|
|
14618ee19e | ||
|
|
0b3a75e373 |
@@ -4,6 +4,9 @@ using Starlight.Communication;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Management;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Starlight.AnimeMatrix
|
||||
{
|
||||
@@ -62,26 +65,25 @@ namespace Starlight.AnimeMatrix
|
||||
Off = 0,
|
||||
Dim = 1,
|
||||
Medium = 2,
|
||||
Full = 3
|
||||
Full = 3,
|
||||
Super = 4, //test, doesn't work
|
||||
}
|
||||
|
||||
|
||||
public class AnimeMatrixDevice : Device
|
||||
{
|
||||
private const int UpdatePageLength = 0x0278;
|
||||
int UpdatePageLength = 490;
|
||||
int LedCount = 1450;
|
||||
|
||||
public int LedCount => 1450;
|
||||
|
||||
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
||||
private List<byte[]> frames = new List<byte[]>();
|
||||
|
||||
private int pages = 3;
|
||||
byte[] _displayBuffer;
|
||||
List<byte[]> frames = new List<byte[]>();
|
||||
|
||||
public int MaxColumns = 34;
|
||||
public int MaxRows = 61;
|
||||
|
||||
public int FullRows = 11;
|
||||
|
||||
public int EmptyFirstRow = 0;
|
||||
|
||||
private int frameIndex = 0;
|
||||
|
||||
public AnimeMatrixDevice()
|
||||
@@ -89,14 +91,19 @@ namespace Starlight.AnimeMatrix
|
||||
{
|
||||
string model = GetModel();
|
||||
Debug.WriteLine(model);
|
||||
|
||||
if (model is not null && model.Contains("401"))
|
||||
{
|
||||
pages = 2;
|
||||
|
||||
EmptyFirstRow = 1;
|
||||
FullRows = 6;
|
||||
MaxColumns = 33;
|
||||
MaxRows = 55;
|
||||
LedCount = 1213;
|
||||
UpdatePageLength = 410;
|
||||
}
|
||||
|
||||
_displayBuffer = new byte[LedCount];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +152,7 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
public int EmptyColumns(int row)
|
||||
{
|
||||
if (row == 0) return EmptyFirstRow;
|
||||
return (int)Math.Ceiling(Math.Max(0, row - FullRows) / 2.0);
|
||||
}
|
||||
public int Columns(int row)
|
||||
@@ -159,11 +167,8 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -175,13 +180,13 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
public void SetLedLinear(int address, byte value)
|
||||
{
|
||||
EnsureAddressableLed(address);
|
||||
if (!IsAddressableLed(address)) return;
|
||||
_displayBuffer[address] = value;
|
||||
}
|
||||
|
||||
public void SetLedLinearImmediate(int address, byte value)
|
||||
{
|
||||
EnsureAddressableLed(address);
|
||||
if (!IsAddressableLed(address)) return;
|
||||
_displayBuffer[address] = value;
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
@@ -198,7 +203,7 @@ namespace Starlight.AnimeMatrix
|
||||
EnsureRowInRange(y);
|
||||
var start = RowToLinearAddress(y) - EmptyColumns(y);
|
||||
|
||||
if (x > EmptyColumns(y))
|
||||
if (x >= EmptyColumns(y))
|
||||
SetLedLinear(start + x, value);
|
||||
}
|
||||
|
||||
@@ -214,26 +219,23 @@ namespace Starlight.AnimeMatrix
|
||||
public void Present()
|
||||
{
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 0 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
||||
.AppendData(_displayBuffer[(UpdatePageLength * 0)..(UpdatePageLength * 1)])
|
||||
);
|
||||
int page = 0;
|
||||
int start, end;
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 1 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)UpdatePageLength))
|
||||
.AppendData(_displayBuffer[(UpdatePageLength * 1)..(UpdatePageLength * 2)])
|
||||
);
|
||||
while (page * UpdatePageLength < LedCount)
|
||||
{
|
||||
start = page * UpdatePageLength;
|
||||
end = Math.Min(LedCount, (page + 1) * UpdatePageLength);
|
||||
|
||||
if (pages > 2)
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x02)
|
||||
.AppendData(BitConverter.GetBytes((ushort)(UpdatePageLength * 2 + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)(LedCount - UpdatePageLength * 2)))
|
||||
.AppendData(
|
||||
_displayBuffer[(UpdatePageLength * 2)..(UpdatePageLength * 2 + (LedCount - UpdatePageLength * 2))])
|
||||
.AppendData(BitConverter.GetBytes((ushort)(start + 1)))
|
||||
.AppendData(BitConverter.GetBytes((ushort)(end - start)))
|
||||
.AppendData(_displayBuffer[start..end])
|
||||
);
|
||||
|
||||
page++;
|
||||
}
|
||||
|
||||
Set(Packet<AnimeMatrixPacket>(0xC0, 0x03));
|
||||
}
|
||||
|
||||
@@ -270,10 +272,15 @@ namespace Starlight.AnimeMatrix
|
||||
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)
|
||||
{
|
||||
|
||||
int width = MaxColumns * 3;
|
||||
int width = MaxColumns*3;
|
||||
int height = MaxRows;
|
||||
float scale;
|
||||
|
||||
@@ -289,17 +296,20 @@ namespace Starlight.AnimeMatrix
|
||||
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
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 x = 0; x < bmp.Width; x++)
|
||||
{
|
||||
var pixel = bmp.GetPixel(x, y);
|
||||
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
|
||||
SetLedPlanar(x, y, color);
|
||||
if (x % 2 == (y % 2))
|
||||
{
|
||||
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)
|
||||
{
|
||||
throw new IndexOutOfRangeException($"Linear LED address must be in range of [0, {LedCount - 1}].");
|
||||
}
|
||||
return (address >= 0 && address < LedCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,31 +6,35 @@ public static class ControlHelper
|
||||
{
|
||||
|
||||
static bool _invert = false;
|
||||
static bool _resize = false;
|
||||
|
||||
static float _scale = 1;
|
||||
|
||||
static Color formBack;
|
||||
static Color backMain;
|
||||
static Color foreMain;
|
||||
static Color foreAccent;
|
||||
static Color borderMain;
|
||||
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);
|
||||
backMain = Color.FromArgb(255, 50, 50, 50);
|
||||
foreMain = Color.White;
|
||||
foreAccent = Color.FromArgb(255, 100, 100, 100);
|
||||
borderMain = Color.FromArgb(255, 50, 50, 50);
|
||||
buttonMain = Color.FromArgb(255, 100, 100, 100);
|
||||
buttonMain = Color.FromArgb(255, 80, 80, 80);
|
||||
}
|
||||
else
|
||||
{
|
||||
formBack = SystemColors.Control;
|
||||
backMain = SystemColors.ControlLightLight;
|
||||
foreMain = SystemColors.ControlText;
|
||||
foreAccent = Color.LightGray;
|
||||
borderMain = Color.LightGray;
|
||||
buttonMain = SystemColors.ControlLight;
|
||||
}
|
||||
@@ -43,15 +47,38 @@ public static class ControlHelper
|
||||
_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)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
{
|
||||
var button = control as Button;
|
||||
var button = control as RButton;
|
||||
if (button != null)
|
||||
{
|
||||
button.BackColor = backMain;
|
||||
button.BackColor = button.Secondary ? buttonMain : backMain;
|
||||
button.ForeColor = foreMain;
|
||||
|
||||
button.FlatStyle = FlatStyle.Flat;
|
||||
@@ -62,11 +89,9 @@ public static class ControlHelper
|
||||
}
|
||||
|
||||
var pictureBox = control as PictureBox;
|
||||
if (pictureBox != null)
|
||||
{
|
||||
if (pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
|
||||
}
|
||||
if (pictureBox != null && pictureBox.BackgroundImage is not null)
|
||||
pictureBox.BackgroundImage = AdjustImage(pictureBox.BackgroundImage);
|
||||
|
||||
|
||||
var combo = control as RComboBox;
|
||||
if (combo != null)
|
||||
@@ -89,8 +114,8 @@ public static class ControlHelper
|
||||
{
|
||||
chart.BackColor = backMain;
|
||||
chart.ChartAreas[0].BackColor = backMain;
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreMain;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreMain;
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
|
||||
|
||||
chart.ChartAreas[0].AxisX.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].AxisY.MajorTickMark.LineColor = foreMain;
|
||||
|
||||
chart.ChartAreas[0].AxisX.LineColor = foreMain;
|
||||
chart.ChartAreas[0].AxisY.LineColor = foreMain;
|
||||
chart.ChartAreas[0].AxisX.LineColor = foreAccent;
|
||||
chart.ChartAreas[0].AxisY.LineColor = foreAccent;
|
||||
|
||||
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 pic = new Bitmap(newSize.Width, newSize.Height);
|
||||
@@ -131,6 +156,12 @@ public static class ControlHelper
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(image, new Rectangle(new Point(), newSize));
|
||||
}
|
||||
return pic;
|
||||
}
|
||||
|
||||
private static Image AdjustImage(Image image)
|
||||
{
|
||||
var pic = new Bitmap(image);
|
||||
|
||||
if (_invert)
|
||||
{
|
||||
@@ -145,6 +176,7 @@ public static class ControlHelper
|
||||
}
|
||||
|
||||
return pic;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -18,25 +19,38 @@ namespace CustomControls
|
||||
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
||||
|
||||
public bool darkTheme;
|
||||
public bool invert = false;
|
||||
public bool darkTheme = false;
|
||||
|
||||
public void InitTheme()
|
||||
private static bool IsDarkTheme()
|
||||
{
|
||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||
invert = (darkTheme != newDarkTheme);
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
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;
|
||||
|
||||
ControlHelper.Adjust(this, 2, invert);
|
||||
try
|
||||
{
|
||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||
} catch { }
|
||||
if (setDPI)
|
||||
ControlHelper.Resize(this);
|
||||
|
||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||
ControlHelper.Adjust(this, darkTheme, changed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RTrackBar : TrackBar
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class RComboBox : ComboBox
|
||||
{
|
||||
private Color borderColor = Color.Gray;
|
||||
@@ -221,8 +235,11 @@ namespace CustomControls
|
||||
{
|
||||
//Fields
|
||||
private int borderSize = 5;
|
||||
private int borderRadius = 3;
|
||||
private int borderRadius = 5;
|
||||
|
||||
private bool activated = false;
|
||||
private bool secondary = false;
|
||||
|
||||
private Color borderColor = Color.Transparent;
|
||||
|
||||
public Color BorderColor
|
||||
@@ -247,6 +264,14 @@ namespace CustomControls
|
||||
}
|
||||
}
|
||||
|
||||
public bool Secondary
|
||||
{
|
||||
get { return secondary; }
|
||||
set
|
||||
{
|
||||
secondary = value;
|
||||
}
|
||||
}
|
||||
|
||||
public RButton()
|
||||
{
|
||||
|
||||
120
app/CustomControls.resx
Normal file
120
app/CustomControls.resx
Normal 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
27
app/Fans.Designer.cs
generated
@@ -31,10 +31,10 @@ namespace GHelper
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
ChartArea chartArea3 = new ChartArea();
|
||||
Title title3 = new Title();
|
||||
ChartArea chartArea4 = new ChartArea();
|
||||
Title title4 = new Title();
|
||||
ChartArea chartArea1 = new ChartArea();
|
||||
Title title1 = new Title();
|
||||
ChartArea chartArea2 = new ChartArea();
|
||||
Title title2 = new Title();
|
||||
panelFans = new Panel();
|
||||
labelTip = new Label();
|
||||
labelBoost = new Label();
|
||||
@@ -160,8 +160,8 @@ namespace GHelper
|
||||
//
|
||||
// chartGPU
|
||||
//
|
||||
chartArea3.Name = "ChartArea1";
|
||||
chartGPU.ChartAreas.Add(chartArea3);
|
||||
chartArea1.Name = "ChartArea1";
|
||||
chartGPU.ChartAreas.Add(chartArea1);
|
||||
chartGPU.Dock = DockStyle.Fill;
|
||||
chartGPU.Location = new Point(2, 506);
|
||||
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
||||
@@ -169,13 +169,13 @@ namespace GHelper
|
||||
chartGPU.Size = new Size(760, 476);
|
||||
chartGPU.TabIndex = 17;
|
||||
chartGPU.Text = "chart1";
|
||||
title3.Name = "Title1";
|
||||
chartGPU.Titles.Add(title3);
|
||||
title1.Name = "Title1";
|
||||
chartGPU.Titles.Add(title1);
|
||||
//
|
||||
// chartCPU
|
||||
//
|
||||
chartArea4.Name = "ChartArea1";
|
||||
chartCPU.ChartAreas.Add(chartArea4);
|
||||
chartArea2.Name = "ChartArea1";
|
||||
chartCPU.ChartAreas.Add(chartArea2);
|
||||
chartCPU.Dock = DockStyle.Fill;
|
||||
chartCPU.Location = new Point(2, 10);
|
||||
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
||||
@@ -183,8 +183,8 @@ namespace GHelper
|
||||
chartCPU.Size = new Size(760, 476);
|
||||
chartCPU.TabIndex = 14;
|
||||
chartCPU.Text = "chartCPU";
|
||||
title4.Name = "Title1";
|
||||
chartCPU.Titles.Add(title4);
|
||||
title2.Name = "Title1";
|
||||
chartCPU.Titles.Add(title2);
|
||||
//
|
||||
// labelFans
|
||||
//
|
||||
@@ -219,6 +219,7 @@ namespace GHelper
|
||||
buttonReset.Location = new Point(30, 1081);
|
||||
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
||||
buttonReset.Name = "buttonReset";
|
||||
buttonReset.Secondary = true;
|
||||
buttonReset.Size = new Size(232, 44);
|
||||
buttonReset.TabIndex = 15;
|
||||
buttonReset.Text = "Factory Defaults";
|
||||
@@ -234,6 +235,7 @@ namespace GHelper
|
||||
buttonApply.Location = new Point(542, 1081);
|
||||
buttonApply.Margin = new Padding(4, 2, 4, 2);
|
||||
buttonApply.Name = "buttonApply";
|
||||
buttonApply.Secondary = true;
|
||||
buttonApply.Size = new Size(248, 44);
|
||||
buttonApply.TabIndex = 14;
|
||||
buttonApply.Text = "Apply Fan Curve";
|
||||
@@ -303,6 +305,7 @@ namespace GHelper
|
||||
buttonApplyPower.Location = new Point(20, 1081);
|
||||
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
|
||||
buttonApplyPower.Name = "buttonApplyPower";
|
||||
buttonApplyPower.Secondary = true;
|
||||
buttonApplyPower.Size = new Size(324, 44);
|
||||
buttonApplyPower.TabIndex = 24;
|
||||
buttonApplyPower.Text = "Apply Power Limits";
|
||||
|
||||
@@ -35,9 +35,6 @@ namespace GHelper
|
||||
|
||||
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.Maximum = 100;
|
||||
chart.ChartAreas[0].AxisX.Interval = 10;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.34</AssemblyVersion>
|
||||
<AssemblyVersion>0.33</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace GHelper
|
||||
|
||||
}
|
||||
|
||||
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
|
||||
SystemEvents.UserPreferenceChanged += new
|
||||
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
||||
|
||||
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;
|
||||
@@ -91,13 +92,14 @@ namespace GHelper
|
||||
{
|
||||
case UserPreferenceCategory.General:
|
||||
Debug.WriteLine("Theme Changed");
|
||||
settingsForm.InitTheme();
|
||||
Thread.Sleep(500);
|
||||
settingsForm.InitTheme(false);
|
||||
|
||||
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 != "")
|
||||
settingsForm.keyb.InitTheme();
|
||||
settingsForm.keyb.InitTheme(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
18
app/Settings.Designer.cs
generated
18
app/Settings.Designer.cs
generated
@@ -186,6 +186,7 @@ namespace GHelper
|
||||
buttonMatrix.Location = new Point(390, 8);
|
||||
buttonMatrix.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonMatrix.Name = "buttonMatrix";
|
||||
buttonMatrix.Secondary = true;
|
||||
buttonMatrix.Size = new Size(185, 44);
|
||||
buttonMatrix.TabIndex = 43;
|
||||
buttonMatrix.Text = "Picture / Gif";
|
||||
@@ -330,6 +331,7 @@ namespace GHelper
|
||||
buttonQuit.Location = new Point(578, 16);
|
||||
buttonQuit.Margin = new Padding(8, 4, 8, 4);
|
||||
buttonQuit.Name = "buttonQuit";
|
||||
buttonQuit.Secondary = true;
|
||||
buttonQuit.Size = new Size(208, 44);
|
||||
buttonQuit.TabIndex = 18;
|
||||
buttonQuit.Text = "Quit";
|
||||
@@ -434,6 +436,7 @@ namespace GHelper
|
||||
buttonSilent.Location = new Point(4, 4);
|
||||
buttonSilent.Margin = new Padding(4);
|
||||
buttonSilent.Name = "buttonSilent";
|
||||
buttonSilent.Secondary = false;
|
||||
buttonSilent.Size = new Size(185, 120);
|
||||
buttonSilent.TabIndex = 0;
|
||||
buttonSilent.Text = "Silent";
|
||||
@@ -454,6 +457,7 @@ namespace GHelper
|
||||
buttonBalanced.Location = new Point(197, 4);
|
||||
buttonBalanced.Margin = new Padding(4);
|
||||
buttonBalanced.Name = "buttonBalanced";
|
||||
buttonBalanced.Secondary = false;
|
||||
buttonBalanced.Size = new Size(185, 120);
|
||||
buttonBalanced.TabIndex = 1;
|
||||
buttonBalanced.Text = "Balanced";
|
||||
@@ -474,6 +478,7 @@ namespace GHelper
|
||||
buttonTurbo.Location = new Point(390, 4);
|
||||
buttonTurbo.Margin = new Padding(4);
|
||||
buttonTurbo.Name = "buttonTurbo";
|
||||
buttonTurbo.Secondary = false;
|
||||
buttonTurbo.Size = new Size(185, 120);
|
||||
buttonTurbo.TabIndex = 2;
|
||||
buttonTurbo.Text = "Turbo";
|
||||
@@ -493,6 +498,7 @@ namespace GHelper
|
||||
buttonFans.Location = new Point(583, 4);
|
||||
buttonFans.Margin = new Padding(4);
|
||||
buttonFans.Name = "buttonFans";
|
||||
buttonFans.Secondary = true;
|
||||
buttonFans.Size = new Size(185, 120);
|
||||
buttonFans.TabIndex = 35;
|
||||
buttonFans.Text = "Fans + Power";
|
||||
@@ -596,6 +602,7 @@ namespace GHelper
|
||||
buttonEco.Location = new Point(4, 4);
|
||||
buttonEco.Margin = new Padding(4);
|
||||
buttonEco.Name = "buttonEco";
|
||||
buttonEco.Secondary = false;
|
||||
buttonEco.Size = new Size(185, 120);
|
||||
buttonEco.TabIndex = 0;
|
||||
buttonEco.Text = "Eco";
|
||||
@@ -616,6 +623,7 @@ namespace GHelper
|
||||
buttonStandard.Location = new Point(197, 4);
|
||||
buttonStandard.Margin = new Padding(4);
|
||||
buttonStandard.Name = "buttonStandard";
|
||||
buttonStandard.Secondary = false;
|
||||
buttonStandard.Size = new Size(185, 120);
|
||||
buttonStandard.TabIndex = 1;
|
||||
buttonStandard.Text = "Standard";
|
||||
@@ -636,6 +644,7 @@ namespace GHelper
|
||||
buttonOptimized.Location = new Point(583, 4);
|
||||
buttonOptimized.Margin = new Padding(4);
|
||||
buttonOptimized.Name = "buttonOptimized";
|
||||
buttonOptimized.Secondary = false;
|
||||
buttonOptimized.Size = new Size(185, 120);
|
||||
buttonOptimized.TabIndex = 3;
|
||||
buttonOptimized.Text = "Optimized";
|
||||
@@ -656,6 +665,7 @@ namespace GHelper
|
||||
buttonUltimate.Location = new Point(390, 4);
|
||||
buttonUltimate.Margin = new Padding(4);
|
||||
buttonUltimate.Name = "buttonUltimate";
|
||||
buttonUltimate.Secondary = false;
|
||||
buttonUltimate.Size = new Size(185, 120);
|
||||
buttonUltimate.TabIndex = 2;
|
||||
buttonUltimate.Text = "Ultimate";
|
||||
@@ -700,6 +710,8 @@ namespace GHelper
|
||||
tableScreen.Controls.Add(buttonScreenAuto, 0, 0);
|
||||
tableScreen.Controls.Add(button60Hz, 1, 0);
|
||||
tableScreen.Controls.Add(button120Hz, 2, 0);
|
||||
tableScreen.Controls.Add(buttonMiniled, 3, 0);
|
||||
|
||||
tableScreen.Location = new Point(16, 51);
|
||||
tableScreen.Margin = new Padding(8, 4, 8, 4);
|
||||
tableScreen.Name = "tableScreen";
|
||||
@@ -720,6 +732,7 @@ namespace GHelper
|
||||
buttonScreenAuto.Location = new Point(4, 4);
|
||||
buttonScreenAuto.Margin = new Padding(4);
|
||||
buttonScreenAuto.Name = "buttonScreenAuto";
|
||||
buttonScreenAuto.Secondary = false;
|
||||
buttonScreenAuto.Size = new Size(185, 72);
|
||||
buttonScreenAuto.TabIndex = 0;
|
||||
buttonScreenAuto.Text = "Auto";
|
||||
@@ -738,6 +751,7 @@ namespace GHelper
|
||||
button60Hz.Location = new Point(197, 4);
|
||||
button60Hz.Margin = new Padding(4);
|
||||
button60Hz.Name = "button60Hz";
|
||||
button60Hz.Secondary = false;
|
||||
button60Hz.Size = new Size(185, 72);
|
||||
button60Hz.TabIndex = 1;
|
||||
button60Hz.Text = "60Hz";
|
||||
@@ -755,6 +769,7 @@ namespace GHelper
|
||||
button120Hz.Location = new Point(390, 4);
|
||||
button120Hz.Margin = new Padding(4);
|
||||
button120Hz.Name = "button120Hz";
|
||||
button120Hz.Secondary = false;
|
||||
button120Hz.Size = new Size(185, 72);
|
||||
button120Hz.TabIndex = 2;
|
||||
button120Hz.Text = "120Hz + OD";
|
||||
@@ -829,6 +844,7 @@ namespace GHelper
|
||||
buttonKeyboard.Location = new Point(390, 8);
|
||||
buttonKeyboard.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonKeyboard.Name = "buttonKeyboard";
|
||||
buttonKeyboard.Secondary = true;
|
||||
buttonKeyboard.Size = new Size(185, 44);
|
||||
buttonKeyboard.TabIndex = 37;
|
||||
buttonKeyboard.Text = "Extra";
|
||||
@@ -895,6 +911,7 @@ namespace GHelper
|
||||
buttonKeyboardColor.Location = new Point(0, 0);
|
||||
buttonKeyboardColor.Margin = new Padding(4, 8, 4, 8);
|
||||
buttonKeyboardColor.Name = "buttonKeyboardColor";
|
||||
buttonKeyboardColor.Secondary = false;
|
||||
buttonKeyboardColor.Size = new Size(185, 44);
|
||||
buttonKeyboardColor.TabIndex = 39;
|
||||
buttonKeyboardColor.Text = "Color ";
|
||||
@@ -935,6 +952,7 @@ namespace GHelper
|
||||
buttonMiniled.Location = new Point(197, 4);
|
||||
buttonMiniled.Margin = new Padding(4);
|
||||
buttonMiniled.Name = "buttonMiniled";
|
||||
buttonMiniled.Secondary = false;
|
||||
buttonMiniled.Size = new Size(185, 72);
|
||||
buttonMiniled.TabIndex = 3;
|
||||
buttonMiniled.Text = "Miniled";
|
||||
|
||||
@@ -532,8 +532,8 @@ namespace GHelper
|
||||
int brightness = Program.config.getConfig("matrix_brightness");
|
||||
int running = Program.config.getConfig("matrix_running");
|
||||
|
||||
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
|
||||
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
|
||||
comboMatrix.SelectedIndex = (brightness != -1) ? Math.Min(brightness, comboMatrix.Items.Count-1) : 0;
|
||||
comboMatrixRunning.SelectedIndex = (running != -1) ? Math.Min(running, comboMatrixRunning.Items.Count - 1) : 0;
|
||||
|
||||
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
|
||||
|
||||
@@ -705,9 +705,11 @@ namespace GHelper
|
||||
|
||||
if (miniled >= 0)
|
||||
{
|
||||
tableScreen.Controls.Add(buttonMiniled, 3, 0);
|
||||
buttonMiniled.Activated = (miniled == 1);
|
||||
Program.config.setConfig("miniled", miniled);
|
||||
} else
|
||||
{
|
||||
buttonMiniled.Visible = false;
|
||||
}
|
||||
|
||||
Program.config.setConfig("frequency", frequency);
|
||||
|
||||
BIN
docs/screenshot-dark.png
Normal file
BIN
docs/screenshot-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Reference in New Issue
Block a user