mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Option to bind G-Helper window to any macro key https://github.com/seerge/g-helper/issues/1389
Auto refresh tweaks https://github.com/seerge/g-helper/issues/1395 Anime Matrix tweaks
This commit is contained in:
@@ -350,6 +350,8 @@ namespace GHelper.AnimeMatrix
|
|||||||
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
||||||
int matrixSpeed = AppConfig.Get("matrix_speed", 50);
|
int matrixSpeed = AppConfig.Get("matrix_speed", 50);
|
||||||
|
|
||||||
|
MatrixRotation rotation = (MatrixRotation)AppConfig.Get("matrix_rotation", 0);
|
||||||
|
|
||||||
InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0);
|
InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0);
|
||||||
|
|
||||||
|
|
||||||
@@ -364,7 +366,12 @@ namespace GHelper.AnimeMatrix
|
|||||||
for (int i = 0; i < frameCount; i++)
|
for (int i = 0; i < frameCount; i++)
|
||||||
{
|
{
|
||||||
image.SelectActiveFrame(dimension, i);
|
image.SelectActiveFrame(dimension, i);
|
||||||
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
|
||||||
|
if (rotation == MatrixRotation.Planar)
|
||||||
|
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
|
else
|
||||||
|
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
|
|
||||||
device.AddFrame();
|
device.AddFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +384,11 @@ namespace GHelper.AnimeMatrix
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
if (rotation == MatrixRotation.Planar)
|
||||||
|
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
|
else
|
||||||
|
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
|
|
||||||
device.Present();
|
device.Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
using GHelper.AnimeMatrix.Communication;
|
using GHelper.AnimeMatrix.Communication;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -51,6 +50,12 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MatrixRotation
|
||||||
|
{
|
||||||
|
Planar,
|
||||||
|
Diagonal
|
||||||
|
}
|
||||||
|
|
||||||
internal class AnimeMatrixPacket : Packet
|
internal class AnimeMatrixPacket : Packet
|
||||||
{
|
{
|
||||||
public AnimeMatrixPacket(byte[] command)
|
public AnimeMatrixPacket(byte[] command)
|
||||||
@@ -90,7 +95,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
public int MaxColumns = 34;
|
public int MaxColumns = 34;
|
||||||
public int LedStart = 0;
|
public int LedStart = 0;
|
||||||
|
|
||||||
public int TextShift = 8;
|
public int FullRows = 11;
|
||||||
|
|
||||||
private int frameIndex = 0;
|
private int frameIndex = 0;
|
||||||
|
|
||||||
@@ -114,7 +119,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
UpdatePageLength = 410;
|
UpdatePageLength = 410;
|
||||||
|
|
||||||
TextShift = 11;
|
FullRows = 5;
|
||||||
|
|
||||||
LedStart = 1;
|
LedStart = 1;
|
||||||
}
|
}
|
||||||
@@ -128,19 +133,11 @@ namespace Starlight.AnimeMatrix
|
|||||||
LedCount = 1711;
|
LedCount = 1711;
|
||||||
UpdatePageLength = 630;
|
UpdatePageLength = 630;
|
||||||
|
|
||||||
TextShift = 10;
|
FullRows = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
_displayBuffer = new byte[LedCount];
|
_displayBuffer = new byte[LedCount];
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < MaxRows; i++)
|
|
||||||
{
|
|
||||||
_model = AnimeType.GA401;
|
|
||||||
Logger.WriteLine(FirstX(i) + " " + Pitch(i));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
LoadMFont();
|
LoadMFont();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -397,19 +394,49 @@ namespace Starlight.AnimeMatrix
|
|||||||
string time = DateTime.Now.ToString("HH" + second + "mm");
|
string time = DateTime.Now.ToString("HH" + second + "mm");
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
TextDiagonal(time, 15, 12, TextShift + 11);
|
Text(time, 15, 0, 24);
|
||||||
TextDiagonal(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11.5F, 3, TextShift);
|
Text(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11F, 0, 14);
|
||||||
Present();
|
Present();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TextDiagonal(string text, float fontSize = 10, int deltaX = 0, int deltaY = 10)
|
private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
|
{
|
||||||
|
var pixel = bmp.GetPixel(x, y);
|
||||||
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
|
if (color > 20)
|
||||||
|
SetLedDiagonal(x, y, (byte)color, deltaX + (FullRows / 2) + 1, deltaY - (FullRows / 2) - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetBitmapLinear(Bitmap bmp)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
|
if (x % 2 == y % 2)
|
||||||
|
{
|
||||||
|
var pixel = bmp.GetPixel(x, y);
|
||||||
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
|
if (color > 20)
|
||||||
|
SetLedPlanar(x / 2, y, (byte)color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Text(string text, float fontSize = 10, int x = 0, int y = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
int width = MaxRows - FullRows;
|
||||||
int textHeight;
|
int height = MaxRows - FullRows;
|
||||||
|
int textHeight, textWidth;
|
||||||
|
|
||||||
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
using (Bitmap bmp = new Bitmap(width, height))
|
||||||
{
|
{
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
{
|
{
|
||||||
@@ -421,59 +448,19 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
SizeF textSize = g.MeasureString(text, font);
|
SizeF textSize = g.MeasureString(text, font);
|
||||||
textHeight = (int)textSize.Height;
|
textHeight = (int)textSize.Height;
|
||||||
g.DrawString(text, font, Brushes.White, 0, 0);
|
textWidth = (int)textSize.Width;
|
||||||
|
g.DrawString(text, font, Brushes.White, x, height - y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
SetBitmapDiagonal(bmp, (width - textWidth), height);
|
||||||
{
|
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
|
||||||
{
|
|
||||||
var pixel = bmp.GetPixel(x, y);
|
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
|
||||||
if (color > 100) SetLedDiagonal(x, y, (byte)color, deltaX, deltaY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void PresentText(string text1, string text2 = "")
|
|
||||||
{
|
|
||||||
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
|
||||||
{
|
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
|
||||||
{
|
|
||||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
|
||||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
|
||||||
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
|
||||||
|
|
||||||
using (Font font = new Font("Consolas", 22F, FontStyle.Regular, GraphicsUnit.Pixel))
|
|
||||||
{
|
|
||||||
SizeF textSize = g.MeasureString(text1, font);
|
|
||||||
g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (text2.Length > 0)
|
|
||||||
using (Font font = new Font("Consolas", 18F, GraphicsUnit.Pixel))
|
|
||||||
{
|
|
||||||
SizeF textSize = g.MeasureString(text2, font);
|
|
||||||
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 1, 25);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp.Save("test.bmp", ImageFormat.Bmp);
|
|
||||||
|
|
||||||
GenerateFrame(bmp);
|
|
||||||
Present();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = MaxColumns / 2 * 6;
|
int width = MaxColumns / 2 * 6;
|
||||||
int height = MaxRows;
|
int height = MaxRows;
|
||||||
|
|
||||||
@@ -498,22 +485,42 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
Clear();
|
||||||
|
SetBitmapLinear(bmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
||||||
|
{
|
||||||
|
int width = MaxRows - FullRows;
|
||||||
|
int height = MaxRows - FullRows*2;
|
||||||
|
float scale;
|
||||||
|
|
||||||
|
using (Bitmap bmp = new Bitmap(width, height))
|
||||||
|
{
|
||||||
|
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height) * zoom / 100;
|
||||||
|
|
||||||
|
using (var graph = Graphics.FromImage(bmp))
|
||||||
{
|
{
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
var scaleWidth = (float)(image.Width * scale);
|
||||||
if (x % 2 == y % 2)
|
var scaleHeight = (float)(image.Height * scale);
|
||||||
{
|
|
||||||
var pixel = bmp.GetPixel(x, y);
|
graph.InterpolationMode = quality;
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
graph.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
if (color < 10) color = 0;
|
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
SetLedPlanar(x / 2, y, (byte)color);
|
|
||||||
}
|
graph.DrawImage(image, width - scaleWidth, height - scaleHeight, scaleWidth, scaleHeight);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clear();
|
||||||
|
SetBitmapDiagonal(bmp, -panX, height + panY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 10)
|
|
||||||
|
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 0)
|
||||||
{
|
{
|
||||||
x += deltaX;
|
x += deltaX;
|
||||||
y -= deltaY;
|
y -= deltaY;
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ public class AsusACPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int DeviceSet(uint DeviceID, byte[] Params, string logName)
|
public int DeviceSet(uint DeviceID, byte[] Params, string? logName)
|
||||||
{
|
{
|
||||||
byte[] args = new byte[4 + Params.Length];
|
byte[] args = new byte[4 + Params.Length];
|
||||||
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
|
||||||
@@ -310,7 +310,9 @@ public class AsusACPI
|
|||||||
byte[] status = CallMethod(DEVS, args);
|
byte[] status = CallMethod(DEVS, args);
|
||||||
int result = BitConverter.ToInt32(status, 0);
|
int result = BitConverter.ToInt32(status, 0);
|
||||||
|
|
||||||
Logger.WriteLine(logName + " = " + BitConverter.ToString(Params) + " : " + (result == 1 ? "OK" : result));
|
if (logName is not null)
|
||||||
|
Logger.WriteLine(logName + " = " + BitConverter.ToString(Params) + " : " + (result == 1 ? "OK" : result));
|
||||||
|
|
||||||
return BitConverter.ToInt32(status, 0);
|
return BitConverter.ToInt32(status, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +542,7 @@ public class AsusACPI
|
|||||||
DeviceSet(TUF_KB_BRIGHTNESS, param, "TUF Brightness");
|
DeviceSet(TUF_KB_BRIGHTNESS, param, "TUF Brightness");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TUFKeyboardRGB(int mode, Color color, int speed)
|
public void TUFKeyboardRGB(int mode, Color color, int speed, string? log = "TUF RGB")
|
||||||
{
|
{
|
||||||
|
|
||||||
byte[] setting = new byte[6];
|
byte[] setting = new byte[6];
|
||||||
@@ -552,8 +554,8 @@ public class AsusACPI
|
|||||||
setting[4] = color.B;
|
setting[4] = color.B;
|
||||||
setting[5] = (byte)speed;
|
setting[5] = (byte)speed;
|
||||||
|
|
||||||
int result = DeviceSet(TUF_KB, setting, "TUF RGB");
|
int result = DeviceSet(TUF_KB, setting, log);
|
||||||
if (result != 1) DeviceSet(TUF_KB2, setting, "TUF RGB");
|
if (result != 1) DeviceSet(TUF_KB2, setting, log);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ namespace GHelper
|
|||||||
|
|
||||||
if (isTuf)
|
if (isTuf)
|
||||||
{
|
{
|
||||||
Program.acpi.TUFKeyboardRGB(0, color, 0);
|
Program.acpi.TUFKeyboardRGB(0, color, 0, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +531,7 @@ namespace GHelper
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.WriteLine(color.ToString());
|
//Debug.WriteLine(color.ToString());
|
||||||
auraDevice.Write(AuraMessage(0, color, color, 0));
|
auraDevice.Write(AuraMessage(0, color, color, 0));
|
||||||
auraDevice.Write(MESSAGE_SET);
|
auraDevice.Write(MESSAGE_SET);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ namespace GHelper.Display
|
|||||||
if (log) Logger.WriteLine(device.monitorDevicePath + " " + device.outputTechnology);
|
if (log) Logger.WriteLine(device.monitorDevicePath + " " + device.outputTechnology);
|
||||||
AppConfig.Set("internal_display", device.monitorFriendlyDeviceName);
|
AppConfig.Set("internal_display", device.monitorFriendlyDeviceName);
|
||||||
var names = device.monitorDevicePath.Split("#");
|
var names = device.monitorDevicePath.Split("#");
|
||||||
return names[1];
|
if (names.Length > 0) return names[1];
|
||||||
|
else return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
46
app/Extra.cs
46
app/Extra.cs
@@ -16,25 +16,33 @@ namespace GHelper
|
|||||||
|
|
||||||
const string EMPTY = "--------------";
|
const string EMPTY = "--------------";
|
||||||
|
|
||||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"", EMPTY},
|
|
||||||
{"mute", Properties.Strings.VolumeMute},
|
|
||||||
{"screenshot", Properties.Strings.PrintScreen},
|
|
||||||
{"play", Properties.Strings.PlayPause},
|
|
||||||
{"aura", Properties.Strings.ToggleAura},
|
|
||||||
{"performance", Properties.Strings.PerformanceMode},
|
|
||||||
{"screen", Properties.Strings.ToggleScreen},
|
|
||||||
{"miniled", Properties.Strings.ToggleMiniled},
|
|
||||||
{"fnlock", Properties.Strings.ToggleFnLock},
|
|
||||||
{"brightness_down", Properties.Strings.BrightnessDown},
|
|
||||||
{"brightness_up", Properties.Strings.BrightnessUp},
|
|
||||||
{"custom", Properties.Strings.Custom}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void SetKeyCombo(ComboBox combo, TextBox txbox, string name)
|
private void SetKeyCombo(ComboBox combo, TextBox txbox, string name)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"", EMPTY},
|
||||||
|
{"mute", Properties.Strings.VolumeMute},
|
||||||
|
{"screenshot", Properties.Strings.PrintScreen},
|
||||||
|
{"play", Properties.Strings.PlayPause},
|
||||||
|
{"aura", Properties.Strings.ToggleAura},
|
||||||
|
{"performance", Properties.Strings.PerformanceMode},
|
||||||
|
{"screen", Properties.Strings.ToggleScreen},
|
||||||
|
{"miniled", Properties.Strings.ToggleMiniled},
|
||||||
|
{"fnlock", Properties.Strings.ToggleFnLock},
|
||||||
|
{"brightness_down", Properties.Strings.BrightnessDown},
|
||||||
|
{"brightness_up", Properties.Strings.BrightnessUp},
|
||||||
|
{"ghelper", Properties.Strings.OpenGHelper},
|
||||||
|
{"custom", Properties.Strings.Custom}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (AppConfig.IsDUO())
|
||||||
|
{
|
||||||
|
customActions.Add("screenpad_down", Properties.Strings.ScreenPadDown);
|
||||||
|
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
|
||||||
|
}
|
||||||
|
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "m1":
|
case "m1":
|
||||||
@@ -48,6 +56,7 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
case "m4":
|
case "m4":
|
||||||
customActions[""] = Properties.Strings.OpenGHelper;
|
customActions[""] = Properties.Strings.OpenGHelper;
|
||||||
|
customActions.Remove("ghelper");
|
||||||
break;
|
break;
|
||||||
case "fnf4":
|
case "fnf4":
|
||||||
customActions[""] = Properties.Strings.ToggleAura;
|
customActions[""] = Properties.Strings.ToggleAura;
|
||||||
@@ -59,7 +68,6 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
case "fne":
|
case "fne":
|
||||||
customActions[""] = "Calculator";
|
customActions[""] = "Calculator";
|
||||||
customActions["ghelper"] = Properties.Strings.OpenGHelper;
|
|
||||||
break;
|
break;
|
||||||
case "paddle":
|
case "paddle":
|
||||||
customActions[""] = EMPTY;
|
customActions[""] = EMPTY;
|
||||||
@@ -131,12 +139,6 @@ namespace GHelper
|
|||||||
|
|
||||||
Text = Properties.Strings.ExtraSettings;
|
Text = Properties.Strings.ExtraSettings;
|
||||||
|
|
||||||
if (AppConfig.IsDUO())
|
|
||||||
{
|
|
||||||
customActions.Add("screenpad_down", Properties.Strings.ScreenPadDown);
|
|
||||||
customActions.Add("screenpad_up", Properties.Strings.ScreenPadUp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AppConfig.IsARCNM())
|
if (AppConfig.IsARCNM())
|
||||||
{
|
{
|
||||||
labelM3.Text = "FN+F6";
|
labelM3.Text = "FN+F6";
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public static class HardwareControl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Discharge Reading: " + ex.Message);
|
Debug.WriteLine("Discharge Reading: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ public static class HardwareControl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Full Charge Reading: " + ex.Message);
|
Debug.WriteLine("Full Charge Reading: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ public static class HardwareControl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Design Capacity Reading: " + ex.Message);
|
Debug.WriteLine("Design Capacity Reading: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
app/Matrix.Designer.cs
generated
46
app/Matrix.Designer.cs
generated
@@ -41,6 +41,9 @@
|
|||||||
panelZoom = new Panel();
|
panelZoom = new Panel();
|
||||||
labelZoom = new Label();
|
labelZoom = new Label();
|
||||||
labelZoomTitle = new Label();
|
labelZoomTitle = new Label();
|
||||||
|
panelRotation = new Panel();
|
||||||
|
comboRotation = new UI.RComboBox();
|
||||||
|
labelRotation = new Label();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)trackZoom).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackZoom).BeginInit();
|
||||||
panelPicture.SuspendLayout();
|
panelPicture.SuspendLayout();
|
||||||
@@ -48,6 +51,7 @@
|
|||||||
panelButtons.SuspendLayout();
|
panelButtons.SuspendLayout();
|
||||||
panelScaling.SuspendLayout();
|
panelScaling.SuspendLayout();
|
||||||
panelZoom.SuspendLayout();
|
panelZoom.SuspendLayout();
|
||||||
|
panelRotation.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// pictureMatrix
|
// pictureMatrix
|
||||||
@@ -106,6 +110,7 @@
|
|||||||
// panelMain
|
// panelMain
|
||||||
//
|
//
|
||||||
panelMain.Controls.Add(panelButtons);
|
panelMain.Controls.Add(panelButtons);
|
||||||
|
panelMain.Controls.Add(panelRotation);
|
||||||
panelMain.Controls.Add(panelScaling);
|
panelMain.Controls.Add(panelScaling);
|
||||||
panelMain.Controls.Add(panelZoom);
|
panelMain.Controls.Add(panelZoom);
|
||||||
panelMain.Controls.Add(panelPicture);
|
panelMain.Controls.Add(panelPicture);
|
||||||
@@ -120,7 +125,7 @@
|
|||||||
panelButtons.Controls.Add(buttonReset);
|
panelButtons.Controls.Add(buttonReset);
|
||||||
panelButtons.Controls.Add(buttonPicture);
|
panelButtons.Controls.Add(buttonPicture);
|
||||||
panelButtons.Dock = DockStyle.Top;
|
panelButtons.Dock = DockStyle.Top;
|
||||||
panelButtons.Location = new Point(0, 642);
|
panelButtons.Location = new Point(0, 720);
|
||||||
panelButtons.Name = "panelButtons";
|
panelButtons.Name = "panelButtons";
|
||||||
panelButtons.Size = new Size(834, 94);
|
panelButtons.Size = new Size(834, 94);
|
||||||
panelButtons.TabIndex = 6;
|
panelButtons.TabIndex = 6;
|
||||||
@@ -211,6 +216,40 @@
|
|||||||
labelZoomTitle.TabIndex = 3;
|
labelZoomTitle.TabIndex = 3;
|
||||||
labelZoomTitle.Text = "Zoom";
|
labelZoomTitle.Text = "Zoom";
|
||||||
//
|
//
|
||||||
|
// panelRotation
|
||||||
|
//
|
||||||
|
panelRotation.Controls.Add(comboRotation);
|
||||||
|
panelRotation.Controls.Add(labelRotation);
|
||||||
|
panelRotation.Dock = DockStyle.Top;
|
||||||
|
panelRotation.Location = new Point(0, 642);
|
||||||
|
panelRotation.Name = "panelRotation";
|
||||||
|
panelRotation.Size = new Size(834, 78);
|
||||||
|
panelRotation.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// comboRotation
|
||||||
|
//
|
||||||
|
comboRotation.BorderColor = Color.White;
|
||||||
|
comboRotation.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
|
comboRotation.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
comboRotation.FormattingEnabled = true;
|
||||||
|
comboRotation.ItemHeight = 32;
|
||||||
|
comboRotation.Items.AddRange(new object[] { "Straight", "Diagonal" });
|
||||||
|
comboRotation.Location = new Point(229, 17);
|
||||||
|
comboRotation.Margin = new Padding(4, 11, 4, 8);
|
||||||
|
comboRotation.Name = "comboRotation";
|
||||||
|
comboRotation.Size = new Size(322, 40);
|
||||||
|
comboRotation.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// labelRotation
|
||||||
|
//
|
||||||
|
labelRotation.AutoSize = true;
|
||||||
|
labelRotation.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelRotation.Location = new Point(16, 20);
|
||||||
|
labelRotation.Name = "labelRotation";
|
||||||
|
labelRotation.Size = new Size(190, 32);
|
||||||
|
labelRotation.TabIndex = 4;
|
||||||
|
labelRotation.Text = "Image Rotation";
|
||||||
|
//
|
||||||
// Matrix
|
// Matrix
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
@@ -236,6 +275,8 @@
|
|||||||
panelScaling.PerformLayout();
|
panelScaling.PerformLayout();
|
||||||
panelZoom.ResumeLayout(false);
|
panelZoom.ResumeLayout(false);
|
||||||
panelZoom.PerformLayout();
|
panelZoom.PerformLayout();
|
||||||
|
panelRotation.ResumeLayout(false);
|
||||||
|
panelRotation.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,5 +295,8 @@
|
|||||||
private Panel panelScaling;
|
private Panel panelScaling;
|
||||||
private Label labelScaling;
|
private Label labelScaling;
|
||||||
private UI.RComboBox comboScaling;
|
private UI.RComboBox comboScaling;
|
||||||
|
private Panel panelRotation;
|
||||||
|
private UI.RComboBox comboRotation;
|
||||||
|
private Label labelRotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,11 +45,22 @@ namespace GHelper
|
|||||||
comboScaling.SelectedIndex = AppConfig.Get("matrix_quality", 0);
|
comboScaling.SelectedIndex = AppConfig.Get("matrix_quality", 0);
|
||||||
comboScaling.SelectedValueChanged += ComboScaling_SelectedValueChanged;
|
comboScaling.SelectedValueChanged += ComboScaling_SelectedValueChanged;
|
||||||
|
|
||||||
|
comboRotation.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboRotation.SelectedIndex = AppConfig.Get("matrix_rotation", 0);
|
||||||
|
comboRotation.SelectedValueChanged += ComboRotation_SelectedValueChanged; ;
|
||||||
|
|
||||||
|
|
||||||
uiScale = panelPicture.Width / matrixControl.device.MaxColumns / 3;
|
uiScale = panelPicture.Width / matrixControl.device.MaxColumns / 3;
|
||||||
panelPicture.Height = (int)(matrixControl.device.MaxRows * uiScale);
|
panelPicture.Height = (int)(matrixControl.device.MaxRows * uiScale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ComboRotation_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppConfig.Set("matrix_rotation", comboRotation.SelectedIndex);
|
||||||
|
SetMatrixPicture(false);
|
||||||
|
}
|
||||||
|
|
||||||
private void ComboScaling_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboScaling_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("matrix_quality", comboScaling.SelectedIndex);
|
AppConfig.Set("matrix_quality", comboScaling.SelectedIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user