mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added informational toolip
This commit is contained in:
@@ -91,7 +91,7 @@ namespace Starlight.AnimeMatrix
|
||||
MaxColumns = 33;
|
||||
|
||||
FullRows = 7;
|
||||
FullEvenRows = 6;
|
||||
FullEvenRows = 1;
|
||||
|
||||
MaxRows = 55;
|
||||
LedCount = 1214;
|
||||
@@ -277,20 +277,17 @@ namespace Starlight.AnimeMatrix
|
||||
}
|
||||
|
||||
|
||||
public void PresentText(string text, int fontSize = 8)
|
||||
public void PresentText(string text, float fontSize = 8F)
|
||||
{
|
||||
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
||||
{
|
||||
int width = MaxColumns * 3;
|
||||
int height = MaxRows;
|
||||
|
||||
Bitmap bmp = new Bitmap(width, height);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
using (Font font = new Font("Arial", fontSize))
|
||||
{
|
||||
|
||||
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
SizeF textSize = g.MeasureString(text, font);
|
||||
|
||||
/*
|
||||
@@ -305,6 +302,7 @@ namespace Starlight.AnimeMatrix
|
||||
|
||||
GenerateFrame(bmp);
|
||||
Present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -315,11 +313,12 @@ namespace Starlight.AnimeMatrix
|
||||
int height = MaxRows;
|
||||
float scale;
|
||||
|
||||
Bitmap canvas = new Bitmap(width, height);
|
||||
|
||||
using (Bitmap canvas = new Bitmap(width, height))
|
||||
{
|
||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
||||
|
||||
var graph = Graphics.FromImage(canvas);
|
||||
using (var graph = Graphics.FromImage(canvas))
|
||||
{
|
||||
var scaleWidth = (int)(image.Width * scale);
|
||||
var scaleHeight = (int)(image.Height * scale);
|
||||
|
||||
@@ -328,21 +327,18 @@ namespace Starlight.AnimeMatrix
|
||||
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||
|
||||
graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight);
|
||||
}
|
||||
|
||||
Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows);
|
||||
|
||||
using (Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows))
|
||||
{
|
||||
for (int y = 0; y < bmp.Height; y++)
|
||||
{
|
||||
for (int x = 0; x < bmp.Width; x++)
|
||||
{
|
||||
if (x % 2 == y % 2)
|
||||
{
|
||||
var color = GetColor(bmp, x, y);
|
||||
SetLedPlanar(x / 2, y, (byte)color);
|
||||
}
|
||||
SetLedPlanar(x / 2, y, (byte)GetColor(bmp, x, y));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void EnsureRowInRange(int row)
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace GHelper
|
||||
|
||||
ds = settingsForm.Handle;
|
||||
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||
|
||||
|
||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ namespace GHelper
|
||||
public partial class SettingsForm : RForm
|
||||
{
|
||||
|
||||
static System.Timers.Timer aTimer = default!;
|
||||
public static System.Timers.Timer aTimer = default!;
|
||||
public static Point trayPoint;
|
||||
|
||||
static System.Timers.Timer matrixTimer = default!;
|
||||
|
||||
public string versionUrl = "http://github.com/seerge/g-helper/releases";
|
||||
@@ -21,7 +23,6 @@ namespace GHelper
|
||||
public Keyboard keyb;
|
||||
|
||||
static AnimeMatrixDevice mat;
|
||||
static int matrixMode = 0;
|
||||
|
||||
public SettingsForm()
|
||||
{
|
||||
@@ -115,12 +116,40 @@ namespace GHelper
|
||||
button120Hz.MouseMove += Button120Hz_MouseHover;
|
||||
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
|
||||
|
||||
//Program.trayIcon.MouseMove += TrayIcon_MouseMove;
|
||||
|
||||
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
|
||||
|
||||
SetTimer();
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
|
||||
}
|
||||
|
||||
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
|
||||
{
|
||||
trayPoint = Cursor.Position;
|
||||
|
||||
if (!aTimer.Enabled)
|
||||
{
|
||||
aTimer.Interval = 100;
|
||||
aTimer.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
if (Program.settingsForm.Visible || Cursor.Position == trayPoint)
|
||||
{
|
||||
aTimer.Interval = 2000;
|
||||
RefreshSensors();
|
||||
} else
|
||||
{
|
||||
Program.trayIcon.Text = "";
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Button120Hz_MouseHover(object? sender, EventArgs e)
|
||||
{
|
||||
@@ -350,6 +379,8 @@ namespace GHelper
|
||||
if (fileName is not null)
|
||||
{
|
||||
Program.config.setConfig("matrix_picture", fileName);
|
||||
Program.config.setConfig("matrix_running", 2);
|
||||
|
||||
SetMatrixPicture(fileName);
|
||||
BeginInvoke(delegate
|
||||
{
|
||||
@@ -408,8 +439,7 @@ namespace GHelper
|
||||
switch (running)
|
||||
{
|
||||
case 2:
|
||||
string fileName = Program.config.getConfigString("matrix_picture");
|
||||
SetMatrixPicture(fileName);
|
||||
SetMatrixPicture(Program.config.getConfigString("matrix_picture"));
|
||||
break;
|
||||
case 3:
|
||||
mat.SetBuiltInAnimation(false);
|
||||
@@ -762,14 +792,6 @@ namespace GHelper
|
||||
SetGPUMode(ASUSWmi.GPUModeEco);
|
||||
}
|
||||
|
||||
private static void SetTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
aTimer.AutoReset = true;
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
private static string FormatFan(int fan)
|
||||
{
|
||||
@@ -811,14 +833,12 @@ namespace GHelper
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
||||
if (midFan is not null) Program.settingsForm.labelMidFan.Text = "Mid" + midFan;
|
||||
Program.settingsForm.labelBattery.Text = battery;
|
||||
|
||||
Program.trayIcon.Text = "CPU" + cpuTemp + cpuFan + "\n" + "GPU" + gpuTemp + gpuFan + ((battery.Length > 0) ? ("\n" + battery) : "");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
RefreshSensors();
|
||||
aTimer.Interval = 2000;
|
||||
}
|
||||
|
||||
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user