mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
5 Commits
visual_mod
...
v0.158
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a49ac1072e | ||
|
|
1b098cd3ee | ||
|
|
a05eaea343 | ||
|
|
f749bfc888 | ||
|
|
84f03d7455 |
@@ -539,7 +539,7 @@ public static class AppConfig
|
||||
|
||||
public static bool IsAMDLight()
|
||||
{
|
||||
return ContainsModel("GA402X") || ContainsModel("GU605") || ContainsModel("GA403") || ContainsModel("FA507N") || ContainsModel("FA507X") || ContainsModel("FA707N") || ContainsModel("FA707X");
|
||||
return ContainsModel("GA402X") || ContainsModel("GA403") || ContainsModel("FA507N") || ContainsModel("FA507X") || ContainsModel("FA707N") || ContainsModel("FA707X");
|
||||
}
|
||||
|
||||
public static bool IsPowerRequired()
|
||||
|
||||
@@ -1,94 +1,15 @@
|
||||
using GHelper.Helpers;
|
||||
using GHelper.Mode;
|
||||
using System.Management;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
enum SplendidCommand: int
|
||||
{
|
||||
Init = 10,
|
||||
DimmingAsus = 9,
|
||||
DimmingVisual = 19
|
||||
}
|
||||
|
||||
public static class ScreenControl
|
||||
public class ScreenControl
|
||||
{
|
||||
|
||||
public const int MAX_REFRESH = 1000;
|
||||
|
||||
public static DisplayGammaRamp? gammaRamp;
|
||||
|
||||
private static int _brightness = 100;
|
||||
private static bool _init = true;
|
||||
private static string? _splendidPath = null;
|
||||
|
||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
||||
|
||||
static ScreenControl () {
|
||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||
}
|
||||
|
||||
private static string GetSplendidPath()
|
||||
{
|
||||
if (_splendidPath == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_SystemDriver WHERE Name='ATKWMIACPIIO'"))
|
||||
{
|
||||
foreach (var driver in searcher.Get())
|
||||
{
|
||||
string path = driver["PathName"].ToString();
|
||||
_splendidPath = Path.GetDirectoryName(path) + "\\AsusSplendid.exe";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return _splendidPath;
|
||||
}
|
||||
|
||||
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
|
||||
{
|
||||
var splendid = GetSplendidPath();
|
||||
bool isGameVisual = Directory.Exists("C:\\ProgramData\\ASUS\\GameVisual");
|
||||
bool isSplenddid = File.Exists(splendid);
|
||||
|
||||
if (isSplenddid)
|
||||
{
|
||||
if (command == SplendidCommand.DimmingVisual && !isGameVisual) command = SplendidCommand.DimmingAsus;
|
||||
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
||||
if (result.Contains("file not exist") || (result.Length == 0 && isGameVisual)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
brightnessTimer.Stop();
|
||||
|
||||
|
||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||
|
||||
if (_init)
|
||||
{
|
||||
_init = false;
|
||||
RunSplendid(SplendidCommand.Init);
|
||||
RunSplendid(SplendidCommand.Init, 4);
|
||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||
}
|
||||
|
||||
// GammaRamp Fallback
|
||||
SetGamma(_brightness);
|
||||
}
|
||||
|
||||
public static void AutoScreen(bool force = false)
|
||||
public void AutoScreen(bool force = false)
|
||||
{
|
||||
if (force || AppConfig.Is("screen_auto"))
|
||||
{
|
||||
@@ -103,67 +24,8 @@ namespace GHelper.Display
|
||||
}
|
||||
}
|
||||
|
||||
public static int SetBrightness(int brightness = -1, int delta = 0)
|
||||
{
|
||||
if (!AppConfig.IsOLED()) return -1;
|
||||
|
||||
if (brightness < 0) brightness = AppConfig.Get("brightness", 100);
|
||||
|
||||
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
||||
AppConfig.Set("brightness", _brightness);
|
||||
|
||||
brightnessTimer.Start();
|
||||
|
||||
Program.settingsForm.VisualiseBrightness();
|
||||
|
||||
return _brightness;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SetGamma(int brightness = 100)
|
||||
{
|
||||
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
|
||||
|
||||
var screenName = ScreenNative.FindLaptopScreen();
|
||||
if (screenName is null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
||||
if (gammaRamp is null)
|
||||
{
|
||||
var gammaDump = new GammaRamp();
|
||||
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
|
||||
{
|
||||
gammaRamp = new DisplayGammaRamp(gammaDump);
|
||||
//Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
|
||||
//Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
|
||||
//Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
|
||||
}
|
||||
}
|
||||
|
||||
if (gammaRamp is null || !gammaRamp.IsOriginal())
|
||||
{
|
||||
Logger.WriteLine("Not default Gamma");
|
||||
gammaRamp = new DisplayGammaRamp();
|
||||
}
|
||||
|
||||
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
||||
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
|
||||
|
||||
Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
//ScreenBrightness.Set(60 + (int)(40 * bright));
|
||||
}
|
||||
|
||||
public static void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||
public void SetScreen(int frequency = -1, int overdrive = -1, int miniled = -1)
|
||||
{
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen(true);
|
||||
|
||||
@@ -200,7 +62,7 @@ namespace GHelper.Display
|
||||
}
|
||||
|
||||
|
||||
public static int ToogleMiniled()
|
||||
public int ToogleMiniled()
|
||||
{
|
||||
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
|
||||
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
|
||||
@@ -228,7 +90,7 @@ namespace GHelper.Display
|
||||
return miniled;
|
||||
}
|
||||
|
||||
public static void InitScreen()
|
||||
public void InitScreen()
|
||||
{
|
||||
var laptopScreen = ScreenNative.FindLaptopScreen();
|
||||
|
||||
|
||||
245
app/Display/VisualControl.cs
Normal file
245
app/Display/VisualControl.cs
Normal file
@@ -0,0 +1,245 @@
|
||||
using GHelper.Helpers;
|
||||
using System.Management;
|
||||
|
||||
namespace GHelper.Display
|
||||
{
|
||||
public enum SplendidGamut : int
|
||||
{
|
||||
Native = 50,
|
||||
sRGB = 51,
|
||||
DCIP3 = 53,
|
||||
DisplayP3 = 54
|
||||
}
|
||||
|
||||
public enum SplendidCommand : int
|
||||
{
|
||||
Init = 10,
|
||||
DimmingAsus = 9,
|
||||
DimmingVisual = 19,
|
||||
GamutMode = 200,
|
||||
|
||||
Default = 11,
|
||||
Racing = 21,
|
||||
Scenery = 22,
|
||||
RTS = 23,
|
||||
FPS = 24,
|
||||
Cinema = 25,
|
||||
Vivid = 13,
|
||||
Eyecare = 17,
|
||||
}
|
||||
public static class VisualControl
|
||||
{
|
||||
public static DisplayGammaRamp? gammaRamp;
|
||||
|
||||
private static int _brightness = 100;
|
||||
private static bool _init = true;
|
||||
private static string? _splendidPath = null;
|
||||
|
||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
||||
|
||||
|
||||
static VisualControl()
|
||||
{
|
||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||
}
|
||||
|
||||
private static string GetGameVisualPath()
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\ASUS\\GameVisual";
|
||||
}
|
||||
|
||||
public static Dictionary<SplendidGamut, string> GetGamutModes()
|
||||
{
|
||||
Dictionary<SplendidGamut, string> _modes = new Dictionary<SplendidGamut, string>();
|
||||
|
||||
string gameVisualPath = GetGameVisualPath();
|
||||
if (!Directory.Exists(gameVisualPath))
|
||||
{
|
||||
Logger.WriteLine(gameVisualPath + "doesn't exit");
|
||||
return _modes;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DirectoryInfo d = new DirectoryInfo(GetGameVisualPath());
|
||||
FileInfo[] icms = d.GetFiles("*.icm");
|
||||
if (icms.Length == 0) return _modes;
|
||||
|
||||
_modes.Add(SplendidGamut.Native, "Gamut: Native");
|
||||
foreach (FileInfo icm in icms)
|
||||
{
|
||||
if (icm.Name.Contains("sRGB")) _modes.Add(SplendidGamut.sRGB, "Gamut: sRGB");
|
||||
if (icm.Name.Contains("DCIP3")) _modes.Add(SplendidGamut.DCIP3, "Gamut: DCIP3");
|
||||
if (icm.Name.Contains("DisplayP3")) _modes.Add(SplendidGamut.DisplayP3, "Gamut: DisplayP3");
|
||||
}
|
||||
return _modes;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return _modes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Dictionary<SplendidCommand, string> GetVisualModes()
|
||||
{
|
||||
return new Dictionary<SplendidCommand, string>
|
||||
{
|
||||
{ SplendidCommand.Default, "Default"},
|
||||
{ SplendidCommand.Racing, "Racing"},
|
||||
{ SplendidCommand.Scenery, "Scenery"},
|
||||
{ SplendidCommand.RTS, "RTS/RPG"},
|
||||
{ SplendidCommand.FPS, "FPS"},
|
||||
{ SplendidCommand.Cinema, "Cinema"},
|
||||
{ SplendidCommand.Vivid, "Vivid" },
|
||||
{ SplendidCommand.Eyecare, "Eyecare"}
|
||||
};
|
||||
}
|
||||
|
||||
public static void SetGamut(int mode = 50)
|
||||
{
|
||||
if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return;
|
||||
|
||||
if (_init)
|
||||
{
|
||||
_init = false;
|
||||
RunSplendid(SplendidCommand.Init);
|
||||
RunSplendid(SplendidCommand.GamutMode, 0, mode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = 50)
|
||||
{
|
||||
int balance = mode == SplendidCommand.Eyecare ? 2 : whiteBalance;
|
||||
if (RunSplendid(mode, 0, balance)) return;
|
||||
|
||||
if (_init)
|
||||
{
|
||||
_init = false;
|
||||
RunSplendid(SplendidCommand.Init);
|
||||
RunSplendid(mode, 0, balance);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetSplendidPath()
|
||||
{
|
||||
if (_splendidPath == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_SystemDriver WHERE Name='ATKWMIACPIIO'"))
|
||||
{
|
||||
foreach (var driver in searcher.Get())
|
||||
{
|
||||
string path = driver["PathName"].ToString();
|
||||
_splendidPath = Path.GetDirectoryName(path) + "\\AsusSplendid.exe";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return _splendidPath;
|
||||
}
|
||||
|
||||
private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null)
|
||||
{
|
||||
var splendid = GetSplendidPath();
|
||||
bool isGameVisual = Directory.Exists(GetGameVisualPath());
|
||||
bool isSplenddid = File.Exists(splendid);
|
||||
|
||||
if (isSplenddid)
|
||||
{
|
||||
if (command == SplendidCommand.DimmingVisual && !isGameVisual) command = SplendidCommand.DimmingAsus;
|
||||
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
|
||||
if (result.Contains("file not exist") || (result.Length == 0 && isGameVisual)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
brightnessTimer.Stop();
|
||||
|
||||
|
||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||
|
||||
if (_init)
|
||||
{
|
||||
_init = false;
|
||||
RunSplendid(SplendidCommand.Init);
|
||||
RunSplendid(SplendidCommand.Init, 4);
|
||||
if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return;
|
||||
}
|
||||
|
||||
// GammaRamp Fallback
|
||||
SetGamma(_brightness);
|
||||
}
|
||||
|
||||
public static int SetBrightness(int brightness = -1, int delta = 0)
|
||||
{
|
||||
if (!AppConfig.IsOLED()) return -1;
|
||||
|
||||
if (brightness < 0) brightness = AppConfig.Get("brightness", 100);
|
||||
|
||||
_brightness = Math.Max(0, Math.Min(100, brightness + delta));
|
||||
AppConfig.Set("brightness", _brightness);
|
||||
|
||||
brightnessTimer.Start();
|
||||
|
||||
Program.settingsForm.VisualiseBrightness();
|
||||
|
||||
return _brightness;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SetGamma(int brightness = 100)
|
||||
{
|
||||
var bright = Math.Round((float)brightness / 200 + 0.5, 2);
|
||||
|
||||
var screenName = ScreenNative.FindLaptopScreen();
|
||||
if (screenName is null) return;
|
||||
|
||||
try
|
||||
{
|
||||
var handle = ScreenNative.CreateDC(screenName, screenName, null, IntPtr.Zero);
|
||||
if (gammaRamp is null)
|
||||
{
|
||||
var gammaDump = new GammaRamp();
|
||||
if (ScreenNative.GetDeviceGammaRamp(handle, ref gammaDump))
|
||||
{
|
||||
gammaRamp = new DisplayGammaRamp(gammaDump);
|
||||
//Logger.WriteLine("Gamma R: " + string.Join("-", gammaRamp.Red));
|
||||
//Logger.WriteLine("Gamma G: " + string.Join("-", gammaRamp.Green));
|
||||
//Logger.WriteLine("Gamma B: " + string.Join("-", gammaRamp.Blue));
|
||||
}
|
||||
}
|
||||
|
||||
if (gammaRamp is null || !gammaRamp.IsOriginal())
|
||||
{
|
||||
Logger.WriteLine("Not default Gamma");
|
||||
gammaRamp = new DisplayGammaRamp();
|
||||
}
|
||||
|
||||
var ramp = gammaRamp.AsBrightnessRamp(bright);
|
||||
bool result = ScreenNative.SetDeviceGammaRamp(handle, ref ramp);
|
||||
|
||||
Logger.WriteLine("Gamma " + bright.ToString() + ": " + result);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
//ScreenBrightness.Set(60 + (int)(40 * bright));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace GHelper
|
||||
public partial class Extra : RForm
|
||||
{
|
||||
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
||||
|
||||
const string EMPTY = "--------------";
|
||||
@@ -683,7 +684,7 @@ namespace GHelper
|
||||
private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("no_overdrive", (checkNoOverdrive.Checked ? 1 : 0));
|
||||
ScreenControl.AutoScreen(true);
|
||||
screenControl.AutoScreen(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.157</AssemblyVersion>
|
||||
<AssemblyVersion>0.158</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace GHelper.Gpu
|
||||
public class GPUModeControl
|
||||
{
|
||||
SettingsForm settings;
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
public static int gpuMode;
|
||||
public static bool? gpuExists = null;
|
||||
@@ -158,7 +159,7 @@ namespace GHelper.Gpu
|
||||
settings.Invoke(delegate
|
||||
{
|
||||
InitGPUMode();
|
||||
ScreenControl.AutoScreen();
|
||||
screenControl.AutoScreen();
|
||||
});
|
||||
|
||||
if (eco == 0)
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace GHelper.Helpers
|
||||
ToggleLidAction();
|
||||
|
||||
if (Program.settingsForm.Visible)
|
||||
ScreenControl.InitScreen();
|
||||
Program.screenControl.InitScreen();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace GHelper.Input
|
||||
public static Keys keyApp = Keys.F12;
|
||||
|
||||
static ModeControl modeControl = Program.modeControl;
|
||||
|
||||
static ScreenControl screenControl = new ScreenControl();
|
||||
|
||||
static bool isTUF = AppConfig.IsTUF();
|
||||
|
||||
KeyboardListener listener;
|
||||
@@ -245,7 +246,7 @@ namespace GHelper.Input
|
||||
|
||||
static void SetBrightnessDimming(int delta)
|
||||
{
|
||||
int brightness = ScreenControl.SetBrightness(delta: delta);
|
||||
int brightness = VisualControl.SetBrightness(delta: delta);
|
||||
if (brightness >= 0)
|
||||
Program.toast.RunToast(brightness + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp);
|
||||
}
|
||||
@@ -478,7 +479,7 @@ namespace GHelper.Input
|
||||
break;
|
||||
case "miniled":
|
||||
if (ScreenCCD.GetHDRStatus()) return;
|
||||
int miniled = ScreenControl.ToogleMiniled();
|
||||
int miniled = screenControl.ToogleMiniled();
|
||||
Program.toast.RunToast(miniled == 1 ? "Multi-Zone" : "Single-Zone", miniled == 1 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
|
||||
break;
|
||||
case "aura":
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace GHelper
|
||||
public static ModeControl modeControl = new ModeControl();
|
||||
public static GPUModeControl gpuControl = new GPUModeControl(settingsForm);
|
||||
public static AllyControl allyControl = new AllyControl(settingsForm);
|
||||
public static ScreenControl screenControl = new ScreenControl();
|
||||
public static ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
||||
|
||||
public static ToastForm toast = new ToastForm();
|
||||
@@ -165,7 +166,7 @@ namespace GHelper
|
||||
if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
|
||||
{
|
||||
Logger.WriteLine("Session:" + e.Reason.ToString());
|
||||
ScreenControl.AutoScreen();
|
||||
screenControl.AutoScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ namespace GHelper
|
||||
if (!switched)
|
||||
{
|
||||
gpuControl.InitGPUMode();
|
||||
ScreenControl.AutoScreen();
|
||||
screenControl.AutoScreen();
|
||||
}
|
||||
|
||||
BatteryControl.AutoBattery(init);
|
||||
|
||||
91
app/Settings.Designer.cs
generated
91
app/Settings.Designer.cs
generated
@@ -123,6 +123,9 @@ namespace GHelper
|
||||
pictureAlly = new PictureBox();
|
||||
labelAlly = new Label();
|
||||
panelGamma = new Panel();
|
||||
tableVisual = new TableLayoutPanel();
|
||||
comboVisual = new RComboBox();
|
||||
comboGamut = new RComboBox();
|
||||
sliderGamma = new Slider();
|
||||
panelGammaTitle = new Panel();
|
||||
labelGamma = new Label();
|
||||
@@ -168,6 +171,7 @@ namespace GHelper
|
||||
panelAllyTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAlly).BeginInit();
|
||||
panelGamma.SuspendLayout();
|
||||
tableVisual.SuspendLayout();
|
||||
panelGammaTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureGamma).BeginInit();
|
||||
SuspendLayout();
|
||||
@@ -181,7 +185,7 @@ namespace GHelper
|
||||
panelMatrix.Controls.Add(tableLayoutMatrix);
|
||||
panelMatrix.Controls.Add(panelMatrixTitle);
|
||||
panelMatrix.Dock = DockStyle.Top;
|
||||
panelMatrix.Location = new Point(11, 950);
|
||||
panelMatrix.Location = new Point(11, 1000);
|
||||
panelMatrix.Margin = new Padding(0);
|
||||
panelMatrix.Name = "panelMatrix";
|
||||
panelMatrix.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -356,7 +360,7 @@ namespace GHelper
|
||||
panelBattery.Controls.Add(sliderBattery);
|
||||
panelBattery.Controls.Add(panelBatteryTitle);
|
||||
panelBattery.Dock = DockStyle.Top;
|
||||
panelBattery.Location = new Point(11, 1626);
|
||||
panelBattery.Location = new Point(11, 1676);
|
||||
panelBattery.Margin = new Padding(0);
|
||||
panelBattery.Name = "panelBattery";
|
||||
panelBattery.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -448,7 +452,7 @@ namespace GHelper
|
||||
panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelFooter.Controls.Add(tableButtons);
|
||||
panelFooter.Dock = DockStyle.Top;
|
||||
panelFooter.Location = new Point(11, 1801);
|
||||
panelFooter.Location = new Point(11, 1851);
|
||||
panelFooter.Margin = new Padding(0);
|
||||
panelFooter.Name = "panelFooter";
|
||||
panelFooter.Padding = new Padding(20);
|
||||
@@ -1195,7 +1199,7 @@ namespace GHelper
|
||||
panelKeyboard.Controls.Add(tableLayoutKeyboard);
|
||||
panelKeyboard.Controls.Add(panelKeyboardTitle);
|
||||
panelKeyboard.Dock = DockStyle.Top;
|
||||
panelKeyboard.Location = new Point(11, 1284);
|
||||
panelKeyboard.Location = new Point(11, 1334);
|
||||
panelKeyboard.Margin = new Padding(0);
|
||||
panelKeyboard.Name = "panelKeyboard";
|
||||
panelKeyboard.Padding = new Padding(20);
|
||||
@@ -1371,7 +1375,7 @@ namespace GHelper
|
||||
panelVersion.Controls.Add(labelCharge);
|
||||
panelVersion.Controls.Add(checkStartup);
|
||||
panelVersion.Dock = DockStyle.Top;
|
||||
panelVersion.Location = new Point(11, 1745);
|
||||
panelVersion.Location = new Point(11, 1795);
|
||||
panelVersion.Margin = new Padding(4);
|
||||
panelVersion.Name = "panelVersion";
|
||||
panelVersion.Size = new Size(827, 56);
|
||||
@@ -1396,7 +1400,7 @@ namespace GHelper
|
||||
panelPeripherals.Controls.Add(tableLayoutPeripherals);
|
||||
panelPeripherals.Controls.Add(panelPeripheralsTile);
|
||||
panelPeripherals.Dock = DockStyle.Top;
|
||||
panelPeripherals.Location = new Point(11, 1428);
|
||||
panelPeripherals.Location = new Point(11, 1478);
|
||||
panelPeripherals.Margin = new Padding(0);
|
||||
panelPeripherals.Name = "panelPeripherals";
|
||||
panelPeripherals.Padding = new Padding(20, 20, 20, 10);
|
||||
@@ -1538,7 +1542,7 @@ namespace GHelper
|
||||
panelAlly.Controls.Add(tableLayoutAlly);
|
||||
panelAlly.Controls.Add(panelAllyTitle);
|
||||
panelAlly.Dock = DockStyle.Top;
|
||||
panelAlly.Location = new Point(11, 1144);
|
||||
panelAlly.Location = new Point(11, 1194);
|
||||
panelAlly.Margin = new Padding(0);
|
||||
panelAlly.Name = "panelAlly";
|
||||
panelAlly.Padding = new Padding(20, 20, 20, 0);
|
||||
@@ -1670,6 +1674,7 @@ namespace GHelper
|
||||
//
|
||||
panelGamma.AutoSize = true;
|
||||
panelGamma.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelGamma.Controls.Add(tableVisual);
|
||||
panelGamma.Controls.Add(sliderGamma);
|
||||
panelGamma.Controls.Add(panelGammaTitle);
|
||||
panelGamma.Dock = DockStyle.Top;
|
||||
@@ -1677,23 +1682,78 @@ namespace GHelper
|
||||
panelGamma.Margin = new Padding(0);
|
||||
panelGamma.Name = "panelGamma";
|
||||
panelGamma.Padding = new Padding(20, 20, 20, 10);
|
||||
panelGamma.Size = new Size(827, 123);
|
||||
panelGamma.Size = new Size(827, 173);
|
||||
panelGamma.TabIndex = 9;
|
||||
panelGamma.Visible = false;
|
||||
//
|
||||
// tableVisual
|
||||
//
|
||||
tableVisual.AutoSize = true;
|
||||
tableVisual.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
tableVisual.ColumnCount = 3;
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.Controls.Add(comboVisual, 0, 0);
|
||||
tableVisual.Controls.Add(comboGamut, 0, 0);
|
||||
tableVisual.Dock = DockStyle.Top;
|
||||
tableVisual.Location = new Point(20, 104);
|
||||
tableVisual.Margin = new Padding(8);
|
||||
tableVisual.Name = "tableVisual";
|
||||
tableVisual.RowCount = 1;
|
||||
tableVisual.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
tableVisual.Size = new Size(787, 59);
|
||||
tableVisual.TabIndex = 41;
|
||||
tableVisual.Visible = false;
|
||||
//
|
||||
// comboVisual
|
||||
//
|
||||
comboVisual.BorderColor = Color.White;
|
||||
comboVisual.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboVisual.Dock = DockStyle.Top;
|
||||
comboVisual.FlatStyle = FlatStyle.Flat;
|
||||
comboVisual.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboVisual.FormattingEnabled = true;
|
||||
comboVisual.ItemHeight = 32;
|
||||
comboVisual.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboVisual.Location = new Point(266, 11);
|
||||
comboVisual.Margin = new Padding(4, 11, 4, 8);
|
||||
comboVisual.Name = "comboVisual";
|
||||
comboVisual.Size = new Size(254, 40);
|
||||
comboVisual.TabIndex = 14;
|
||||
comboVisual.Visible = false;
|
||||
//
|
||||
// comboGamut
|
||||
//
|
||||
comboGamut.BorderColor = Color.White;
|
||||
comboGamut.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboGamut.Dock = DockStyle.Top;
|
||||
comboGamut.FlatStyle = FlatStyle.Flat;
|
||||
comboGamut.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboGamut.FormattingEnabled = true;
|
||||
comboGamut.ItemHeight = 32;
|
||||
comboGamut.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboGamut.Location = new Point(4, 11);
|
||||
comboGamut.Margin = new Padding(4, 11, 4, 8);
|
||||
comboGamut.Name = "comboGamut";
|
||||
comboGamut.Size = new Size(254, 40);
|
||||
comboGamut.TabIndex = 13;
|
||||
comboGamut.Visible = false;
|
||||
//
|
||||
// sliderGamma
|
||||
//
|
||||
sliderGamma.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
sliderGamma.Location = new Point(40, 69);
|
||||
sliderGamma.Dock = DockStyle.Top;
|
||||
sliderGamma.Location = new Point(20, 64);
|
||||
sliderGamma.Margin = new Padding(4);
|
||||
sliderGamma.Max = 100;
|
||||
sliderGamma.Min = 0;
|
||||
sliderGamma.Name = "sliderGamma";
|
||||
sliderGamma.Size = new Size(752, 40);
|
||||
sliderGamma.Size = new Size(787, 40);
|
||||
sliderGamma.Step = 10;
|
||||
sliderGamma.TabIndex = 20;
|
||||
sliderGamma.Text = "sliderGamma";
|
||||
sliderGamma.Value = 100;
|
||||
sliderGamma.Visible = false;
|
||||
//
|
||||
// panelGammaTitle
|
||||
//
|
||||
@@ -1736,7 +1796,7 @@ namespace GHelper
|
||||
labelGammaTitle.Location = new Point(43, 0);
|
||||
labelGammaTitle.Margin = new Padding(8, 0, 8, 0);
|
||||
labelGammaTitle.Name = "labelGammaTitle";
|
||||
labelGammaTitle.Size = new Size(307, 32);
|
||||
labelGammaTitle.Size = new Size(506, 32);
|
||||
labelGammaTitle.TabIndex = 37;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
//
|
||||
@@ -1746,7 +1806,7 @@ namespace GHelper
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(849, 2119);
|
||||
ClientSize = new Size(849, 1759);
|
||||
Controls.Add(panelFooter);
|
||||
Controls.Add(panelVersion);
|
||||
Controls.Add(panelBattery);
|
||||
@@ -1826,6 +1886,8 @@ namespace GHelper
|
||||
panelAllyTitle.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureAlly).EndInit();
|
||||
panelGamma.ResumeLayout(false);
|
||||
panelGamma.PerformLayout();
|
||||
tableVisual.ResumeLayout(false);
|
||||
panelGammaTitle.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)pictureGamma).EndInit();
|
||||
ResumeLayout(false);
|
||||
@@ -1931,5 +1993,8 @@ namespace GHelper
|
||||
private Label labelGammaTitle;
|
||||
private CheckBox checkMatrixLid;
|
||||
private Panel panelMatrixAuto;
|
||||
private TableLayoutPanel tableVisual;
|
||||
private RComboBox comboVisual;
|
||||
private RComboBox comboGamut;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace GHelper
|
||||
|
||||
public GPUModeControl gpuControl;
|
||||
public AllyControl allyControl;
|
||||
ScreenControl screenControl = new ScreenControl();
|
||||
AutoUpdateControl updateControl;
|
||||
|
||||
AsusMouseSettings? mouseSettings;
|
||||
@@ -256,18 +257,66 @@ namespace GHelper
|
||||
buttonFnLock.Click += ButtonFnLock_Click;
|
||||
|
||||
panelPerformance.Focus();
|
||||
|
||||
InitBrightness();
|
||||
InitVisual();
|
||||
}
|
||||
|
||||
public void InitBrightness()
|
||||
{
|
||||
if (!AppConfig.IsOLED()) return;
|
||||
panelGamma.Visible = true;
|
||||
VisualiseBrightness();
|
||||
|
||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||
//sliderGamma.MouseUp += SliderGamma_ValueChanged;
|
||||
public void InitVisual()
|
||||
{
|
||||
|
||||
bool dimming = false;
|
||||
|
||||
if (AppConfig.IsOLED())
|
||||
{
|
||||
dimming = true;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
panelGamma.Visible = true;
|
||||
sliderGamma.Visible = true;
|
||||
VisualiseBrightness();
|
||||
sliderGamma.ValueChanged += SliderGamma_ValueChanged;
|
||||
}
|
||||
|
||||
var gamuts = VisualControl.GetGamutModes();
|
||||
if (gamuts.Count < 1) return;
|
||||
|
||||
if (!dimming) labelGammaTitle.Text = "Visual Mode";
|
||||
else labelGammaTitle.Text += " / Visual";
|
||||
|
||||
panelGamma.Visible = true;
|
||||
tableVisual.Visible = true;
|
||||
|
||||
comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboVisual.DataSource = new BindingSource(VisualControl.GetVisualModes(), null);
|
||||
comboVisual.DisplayMember = "Value";
|
||||
comboVisual.ValueMember = "Key";
|
||||
comboVisual.SelectedValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
|
||||
|
||||
comboVisual.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
||||
comboVisual.Visible = true;
|
||||
|
||||
if (gamuts.Count <= 1) return;
|
||||
|
||||
comboGamut.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboGamut.DataSource = new BindingSource(gamuts, null);
|
||||
comboGamut.DisplayMember = "Value";
|
||||
comboGamut.ValueMember = "Key";
|
||||
comboGamut.SelectedValue = (SplendidGamut)AppConfig.Get("gamut", (int)SplendidGamut.Native);
|
||||
|
||||
comboGamut.SelectedValueChanged += ComboGamut_SelectedValueChanged;
|
||||
comboGamut.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
private void ComboGamut_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("gamut", (int)comboGamut.SelectedValue);
|
||||
VisualControl.SetGamut((int)comboGamut.SelectedValue);
|
||||
}
|
||||
|
||||
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
|
||||
VisualControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
||||
}
|
||||
|
||||
public void VisualiseBrightness()
|
||||
@@ -284,7 +333,7 @@ namespace GHelper
|
||||
private void SliderGamma_ValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (sliderGammaIgnore) return;
|
||||
ScreenControl.SetBrightness(sliderGamma.Value);
|
||||
VisualControl.SetBrightness(sliderGamma.Value);
|
||||
}
|
||||
|
||||
private void ButtonOverlay_Click(object? sender, EventArgs e)
|
||||
@@ -426,7 +475,7 @@ namespace GHelper
|
||||
sensorTimer.Enabled = this.Visible;
|
||||
if (this.Visible)
|
||||
{
|
||||
ScreenControl.InitScreen();
|
||||
screenControl.InitScreen();
|
||||
VisualizeXGM();
|
||||
|
||||
Task.Run((Action)RefreshPeripheralsBattery);
|
||||
@@ -705,7 +754,7 @@ namespace GHelper
|
||||
private void ButtonScreenAuto_Click(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("screen_auto", 1);
|
||||
ScreenControl.AutoScreen();
|
||||
screenControl.AutoScreen();
|
||||
}
|
||||
|
||||
|
||||
@@ -1005,19 +1054,19 @@ namespace GHelper
|
||||
private void Button120Hz_Click(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("screen_auto", 0);
|
||||
ScreenControl.SetScreen(ScreenControl.MAX_REFRESH, 1);
|
||||
screenControl.SetScreen(ScreenControl.MAX_REFRESH, 1);
|
||||
}
|
||||
|
||||
private void Button60Hz_Click(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("screen_auto", 0);
|
||||
ScreenControl.SetScreen(60, 0);
|
||||
screenControl.SetScreen(60, 0);
|
||||
}
|
||||
|
||||
|
||||
private void ButtonMiniled_Click(object? sender, EventArgs e)
|
||||
{
|
||||
ScreenControl.ToogleMiniled();
|
||||
screenControl.ToogleMiniled();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user